A critical section object is used for exactly the same purpose as mutexes. The only difference is that under Windows platform critical sections are only visible inside one process, while mutexes may be shared between processes, so using critical sections is slightly more efficient. The terminology is also slightly different: mutex may be locked (or acquired) and unlocked (or released) while critical section is entered and left by the program.
Finally, you should try to use wxCriticalSectionLocker class whenever possible instead of directly using wxCriticalSection for the same reasons wxMutexLocker is preferrable to wxMutex - please see wxMutex for an example.
wxThread, wxCondition, wxCriticalSectionLocker
Default constructor initializes critical section object.
Destructor frees the resources.
Enter the critical section (same as locking a mutex). There is no error return for this function. After entering the critical section protecting some global data the thread running in critical section may safely use/modify it.
Leave the critical section allowing other threads use the global data protected by it. There is no error return for this function.ymasuda 平成17年11月19日