Dispose WaitHandle for basic thread synchronization
问题 According to documentation, WaitHandle in .NET should be explicitly/implicitly disposed. However, I'm having trouble achieving this for the following basic synchronization task: a time consuming task is being executed on a thread. the main thread waits for the task to complete for a predefined time-period. The main thread must proceed if a. the task is completed or b. the timeout occurred. Here my attempt at using an AutoResetEvent object: using(var waitHandle = new AutoResetEvent(false)){