API Reference | developer.brewmp.com API Reference | developer.brewmp.com


API Reference


Brew Release
Brew MP 1.0.2
See Also
AEECLSID_CritSect AEECLSID_InterProcessCritSelect

ICritSect is an interface for using "critical section" objects (also known as "locks" or "mutexes"). It allows multiple threads to coordinate their access to shared data in order to avoid concurrency problems, by ensuring that only one thread at a time is executing "inside" the critical section.
Typically, one critical section object will be used to guard each data set that is manipulated by multiple threads. Any code sequences that modify the data or rely on it being in a known state are guarded with Enter and Exit calls, as shown below:
      me->nCount = me->nCount + 1;

Without this guard, two threads attempting to increment nCount at the same time could end up both reading the same value and then writing the same value.
When a thread terminates while holding a critical section, the state of the critical section object is undefined. Threads must release all of their critical sections before terminating.
Ads with other interfaces, ICritSect is an interface that can be used with many different implementations. Refer to the documentation on the classes being used, such as AEECLSID_CritSect, for a more complete description of the behavior of the lock objects.