I am sure this is pretty basic but I have never worked with ResetEvents
before, but how do I signal a ManualResetEvent of a module that is spun off
into several threads? For instance, if I have 5 threads of the same Sub and
they are all unsignaled, how would I signal them (or one of them)?
Here is a sample of my problem...
Thanks!!
Imports System.Threading
Module Module1
Private mre As ManualResetEvent
Sub Main()
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf Thread), 1)
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf Thread), 2)
Console.WriteLine("Waiting")
Console.ReadLine()
End Sub
Private Sub Thread(ByVal State As Object)
mre = New ManualResetEvent(False)
'...some code
mre.WaitOne()
Console.WriteLine("Done with: " & State)
End Sub
End Module