Group PJ_CRIT_SEC¶
- group PJ_CRIT_SEC
Critical section protection can be used to protect regions where:
mutual exclusion protection is needed.
it’s rather too expensive to create a mutex.
the time spent in the region is very very brief.
Critical section is a global object, and it prevents any threads from entering any regions that are protected by critical section once a thread is already in the section.
Critial section is not recursive!
Application MUST NOT call any functions that may cause current thread to block (such as allocating memory, performing I/O, locking mutex, etc.) while holding the critical section.