Neil: Waiting on it isn't to check whether it's uninitialized; it's to protect the critical section in the cleanup code.
The ReleaseMutex is what's unnecessary -- in fact, I'd call it a bug. You want the second thread to fail, not get the mutex.
Neil: Waiting on it isn't to check whether it's uninitialized; it's to protect the critical section in the cleanup code.
The ReleaseMutex is what's unnecessary -- in fact, I'd call it a bug. You want the second thread to fail, not get the mutex.