B
BogusException
I'll ask a simple question:
How can someone generate any number of threads from within a simple
"for" ot Timer loop/sub (including indefinitely)?
Dim i As Integer
For i = 1 To 10
Dim t As New Thread(AddressOf DoSomethingSub)
t.IsBackground = True
t.Start()
Next i
Semi-surprisingly, the above code generates only 1 thread, not 10. Now
imagine that 100 are needed-or an indefinite amount! This approach
simply doesn't work. In reality, the number of threads needed is
arbitrary, so you can't just have a ton of pre-written Dim
statements...
So now imagine that you need to create and abort/join threads in an
ongoing fashion. An example is doing the above in a Timer's Tick
handler. The threads obviously need to be aborted/joined when the
repetative task is done to free up resources or the system will simply
run out of memory in short order.
Sounds [deceptively] easy, doesn't it!
TIA!
BogusException
How can someone generate any number of threads from within a simple
"for" ot Timer loop/sub (including indefinitely)?
Dim i As Integer
For i = 1 To 10
Dim t As New Thread(AddressOf DoSomethingSub)
t.IsBackground = True
t.Start()
Next i
Semi-surprisingly, the above code generates only 1 thread, not 10. Now
imagine that 100 are needed-or an indefinite amount! This approach
simply doesn't work. In reality, the number of threads needed is
arbitrary, so you can't just have a ton of pre-written Dim
statements...
So now imagine that you need to create and abort/join threads in an
ongoing fashion. An example is doing the above in a Timer's Tick
handler. The threads obviously need to be aborted/joined when the
repetative task is done to free up resources or the system will simply
run out of memory in short order.
Sounds [deceptively] easy, doesn't it!
TIA!
BogusException