I have a thread running in my application. Inside the thread I am waiting on an auto reset event to exit. I want to make sure that i close the handle of the event after i use it. Ihave two options.
- Calling
CloseHandleof the event immediately after callingSetEvent - Calling
CloseHandleafter the lineWaitForSingleObject
Please suggest me which one is the right approach.
Calling
CloseHandleafterSetEventdoesn’t make sense to me. You should (if required) callCloseHandleafterWaitForSingleObjectonly.