Home --> Documentations --> PJLIB Reference


void pj_enter_critical_section (void)
void pj_leave_critical_section (void)

Detailed Description

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.

Function Documentation

◆ pj_enter_critical_section()

void pj_enter_critical_section ( void  )

Enter critical section.

◆ pj_leave_critical_section()

void pj_leave_critical_section ( void  )

Leave critical section.


PJLIB Open Source, high performance, small footprint, and very very portable framework
Copyright (C) 2006-2009 Teluu Inc.