I have two ManualResetEvents, which I use to pass control back and forth between two threads. Essentially a coroutine.
Because the coroutine holds disposable objects (ManualResetEvents are wait handles), it should implement disposable. Also, it should dispose those ManualResetEvents when it is disposed. But, because only one thread runs at a time, one of them is (almost) always waiting on one of the handles.
What is the specified behavior if I dispose both ManualResetEvents? Will the waiting thread be stuck forever, or will disposing terminate the wait? What if I call .Set() first?