#include <const.h>
#include <arch/i386.h>
Go to the source code of this file.
Typedefs | |||
| typedef atomic_t | semaphore_t | ||
| The semaphore type structure. | |||
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.h.
|
|
The semaphore type structure.
Definition at line 15 of file semaphore.h. |
|
|
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 }
|
1.2.18