Protect the following block or statement as a critical section of the program.
Internally this uses a static
::atomic_flag as a spinlock, so this is an active wait.
- Warning
- Such a section should only contain a handful of statements.
-
Such a section should not contain preliminary exits such as
goto
, break
, return
, longjmp
, or P99_UNWIND etc.
Such a critical section is only protected against threads that try to enter this same critical section. Threads may well simultaneously be in different critical sections.
- See also
- P99_SPIN_EXCLUDE to protect several critical sections against each other.
-
P99_MUTUAL_EXCLUDE that is more suited for larger sections.
- Warning
- Restrictions on preliminary exits from the dependent block or statement apply.
- See also
- P99_PROTECTED_BLOCK
-
P99_GUARDED_BLOCK
Definition at line 1430 of file p99_atomic.h.