Consider the following pattern:
private AutoResetEvent signal = new AutoResetEvent(false);
private void Work()
{
while (true)
{
Thread.Sleep(5000
I believe it is not guaranteed.
However, your logic flow is not understood by me. If your main thread Set
s the signal, why should it wait until that signal reaches its destination? Wouldn't it be better to continue your "after signal set" logic in that thread which was waiting?
If you cannot do that, I recommend you to use second WaitHandle
to signal the first thread that the second one has reveiced the signal. But I cannot see any pros of such a strategy.