The best way is probably to use a generic ManualResetEvent .
For example:
class MyClass { private ManualResetEvent workFailedEvent = new ManualResetEvent(false); public List<ThreadResultDto> SendMailAsynch(List<ThreadRequestDto> requestDto) { workFailedEvent.Reset();
The interesting part here is calling WaitOne (0, true) . If you use timeout 0, the thread will not block. Since the ManualResetEvent OS is synchronized by the OS, this particular method call is a convenient way to check the signal without having to worry about race conditions or perform your own lock.
Aaronaught
source share