Reputation: 2195
I'm new to C++ and in my program I have a class that has a private member (CRITICAL_SECTION csPtr
).
The InitializeCriticalSection(&csPtr)
is called in my constructor.
My question is, do I need to call DeleteCriticalSection(&csPtr)
in my destructor?
Upvotes: 0
Views: 996
Reputation: 845
Yes, according to MSDN:
A critical section object cannot be moved or copied. The process must also not modify the object, but must treat it as logically opaque. Use only the critical section functions to manage critical section objects. When you have finished using the critical section, call the
DeleteCriticalSection
function.
Upvotes: 5