#include <const.h>
#include <arch/i386.h>
#include <kernel/task.h>
#include <kernel/semaphore.h>
Go to the source code of this file.
Functions | |||
void | INIT_MUTEX (semaphore_t *sem) | ||
Initialize a semaphore variable.
| |||
void | DOWN (semaphore_t *sem) | ||
Semaphore "down" function.
| |||
void | UP (semaphore_t *sem) | ||
Semaphore "up" function.
|
Definition in file semaphore.c.
|
Semaphore "down" function.
Definition at line 24 of file semaphore.c.
00025 { 00026 dword IF = GET_IF(); 00027 00028 wait_for_wakeup: 00029 if ( atomic_read(sem) ) 00030 { 00031 atomic_set(sem, 0); 00032 } 00033 else 00034 { 00035 enable(); 00036 // Wait for a wake-up. 00037 idle(); 00038 goto wait_for_wakeup; 00039 } 00040 SET_IF(IF); 00041 } |
|
Initialize a semaphore variable.
Definition at line 16 of file semaphore.c.
00017 { 00018 atomic_set(sem, 1); 00019 } |
|
Semaphore "up" function.
Definition at line 46 of file semaphore.c.
00047 { 00048 atomic_set(sem, 1); 00049 } |