|
Zero
0.1.0
|
Go to the source code of this file.
Classes | |
| struct | critical_section< Lock > |
| struct | critical_section< Lock *& > |
| Helper class for CRITICAL_SECTION idiom (macro). More... | |
Macros | |
| #define | CRITICAL_SECTION(name, lock) critical_section<__typeof__(lock)&> name(lock) |
| #define | SPECIALIZE_CS(Lock, Extra, ExtraInit, Acquire, Release) |
| Macro that enables use of CRITICAL_SECTION(name,lock) More... | |
Functions | |
| SPECIALIZE_CS (pthread_mutex_t, int _dummy,(_dummy=0), pthread_mutex_lock(_mutex), pthread_mutex_unlock(_mutex)) | |
| #define CRITICAL_SECTION | ( | name, | |
| lock | |||
| ) | critical_section<__typeof__(lock)&> name(lock) |
This macro starts a critical section protected by the given lock (2nd argument). The critical_section structure it creates is named by the 1st argument. The rest of the scope (in which this macro is used) becomes the scope of the critical section, since it is the destruction of this critical_section structure that releases the lock.
The programmer can release the lock early by calling <name>.pause() or <name>.exit(). The programmer can reacquire the lock by calling <name>.resume() if <name>.pause() was called, but not after <name>.exit().
| #define SPECIALIZE_CS | ( | Lock, | |
| Extra, | |||
| ExtraInit, | |||
| Acquire, | |||
| Release | |||
| ) |
Macro that enables use of CRITICAL_SECTION(name,lock)
Create a templated class that holds
and it
| SPECIALIZE_CS | ( | pthread_mutex_t | , |
| int | _dummy, | ||
| (_dummy=0) | , | ||
| pthread_mutex_lock(_mutex) | , | ||
| pthread_mutex_unlock(_mutex) | |||
| ) |
1.8.12