Is there an easy way to close multiple descriptors?

Is there a way to close multiple handles for threads in C ++ without closing them separately? I have multiple threads with handles that I have stored in an array so I can use WaitForMultipleObjects()

before closing them. I know what I could call CloseHandle

for each array descriptor (either for a loop or one at a time), but I was wondering if there was an easy way to close them all. For example, perhaps running CloseHandle

on the array itself (if that would work)? Or is there a method along the lines CloseMultipleHandles()

? Thanks in advance.

+3


source to share


1 answer


Not. Loop and CloseHandle are the simplest solution. (Not that it's extremely difficult to implement ...).



But then you can always create a CloseAllHandles function that takes an array of handles to close them ...

+6


source







All Articles