Interface: critical section management. More...
Go to the source code of this file.
Classes | |
struct | critsec |
critical section data structure More... | |
Macros | |
#define | locked_decrement(counter) atomic_dec(counter) |
don't use locked_decrement anymore but atomic_dec() More... | |
#define | initialize_critical_section(cs) (cs)->count=0 |
initialize critical section More... | |
#define | leave_critical_section(cs) atomic_dec(&(cs)->count) |
leave critical section More... | |
#define | destroy_critical_section(cs) |
destroy critical section (does nothing) More... | |
Typedefs | |
typedef struct critsec | critsec_t |
critical section type definition More... | |
Functions | |
wakeup_t | wait_critical_section (wakeup_t data) |
wakeup when critical section is available More... | |
int | enter_critical_section (critsec_t *cs) |
enter critical section More... | |
Interface: critical section management.
Defines types and functions to implement critical sections.
Definition in file critsec.h.
#define destroy_critical_section | ( | cs | ) |
destroy critical section (does nothing)
currently there are no resources that are dynamically allocated.
cs | pointer to critical section (critsec_t) |
#define initialize_critical_section | ( | cs | ) | (cs)->count=0 |
initialize critical section
sets count field of critical section to zero
cs | pointer to critical section (critsec_t) |
#define leave_critical_section | ( | cs | ) | atomic_dec(&(cs)->count) |
leave critical section
allow other tasks to enter critical regions of code protected by this critical section.
cs | pointer to critical section (critsec_t) |
Definition at line 101 of file critsec.h.
Referenced by CriticalSectionBlock::~CriticalSectionBlock().
#define locked_decrement | ( | counter | ) | atomic_dec(counter) |
don't use locked_decrement anymore but atomic_dec()
int enter_critical_section | ( | critsec_t * | cs | ) |
enter critical section
block other tasks if they attempt to enter a region of code protected by the same critical section.
cs | pointer to critical section (critsec_t) |
enter critical section
check and lock critical section if it is available; otherwise, wait until it is available, then lock it.
cs | pointer to critical section (critsec_t) |
Definition at line 96 of file critsec.c.
References critsec::count, locked_check_and_increment(), critsec::task, wait_critical_section(), and wait_event().
Referenced by CriticalSectionBlock::CriticalSectionBlock().
wakeup when critical section is available
wakeup function used to sleep a task until a critical section is available. called while processing an interrupt, so interrupts are already disabled.
wakeup function used to detect when a critical section is available. called while processing an interrupt, so interrupts are already disabled.
Definition at line 78 of file critsec.c.
References critsec::count, locked_check_and_increment(), and critsec::task.
Referenced by enter_critical_section().
brickOS is released under the
Mozilla Public License.
Original code copyright 1998-2005 by the authors. |