Initialize Critical Section only once for a process
问题 In a multi threaded application, is there a way to ensure that a Critical Section is initialized only once except for putting the code in DLL main() ?? 回答1: I'd suggest wrapping the CRITICAL_SECTION with a class that will handle the initialization and uninitialization of the critical section object in its constructor and destructor. This way, you'll be thread safe in most cases. (You'll have to make sure no one accesses the object before its constructor completes, but that's relatively easy.)