What are the consequences of calling CloseHandle more than once?
The docs say βyou shouldn't,β but I think I have a realistic case with named pipes where the handle can be closed externally (see end of post).
CloseHandle throws an exception in debug mode in this case, which tells me that the developers consider this to be serious, but the documents are not entirely clear.
(Polite request: please avoid the answer βjust donβt!β :-). Of course, you should avoid closing the handke more than once, and of course there are good methods to help with this: I'm just interested in what happens if you don't).
I heard that some people suggest that if the descriptor were quickly reused by the OS, you could finish closing another, different descriptor.
Is it possible?
How does Windows select handle identifiers?
Is there any guarantee that the descriptor value will be used regularly?
(for example, TCP ensures that the port number cannot be reused during a specific time frame).
Can you close the pens by type of pens? For example, can I think that I am closing the handset, but am ending the event closing?
Thanks!
John
(Context to this: I use named pipes in the client / server model. It is very difficult for me to guarantee that exactly one side is guaranteed to close the descriptor, for example, in the event of a crash / kill. Maybe Iβm wrong, but, of course, the MSDN code example, seems to allow the client to close the common descriptor, and then when the server tries to close it, it is already closed).