-
Close of event
Hello everyone,
For ManualResetEvent and AutoResetEvent, I noticed some samples which does not call Close after using them.
1.
I think to be of good practices, we should call Close after using them -- the reason is both ManualResetEvent and AutoResetEvent wraps native resources and release immediately will make system have more capability to serve in the future?
2.
What native resources are wrapped?
thanks in advance,
George
-
1) Yes. Samples are sometimes sloppy. However, you can also reuse an event, if you need one many times, don't new/close one every time. Just reuse the one you already have. If an event will live over the duration of the whole application, it's not neccessary to close it more than once in the end.
2) On a very wild guess, I'd say it's wrapping an event HANDLE created by the CreateEvent-API m-)