#include <sys/queue.h>
#include <sys/spinlock.h>
Go to the source code of this file.
◆ SEMAPHORE_NAMELEN
#define SEMAPHORE_NAMELEN 32 |
◆ Semaphore
◆ Semaphore_Acquire()
Definition at line 49 of file semaphore.c.
50{
52
53 while (1) {
55 if (sema->
count > 0) {
59 return;
60 }
61
62
65
68 }
69}
void Sched_SetWaiting(Thread *thr)
void Thread_Release(Thread *thr)
#define TAILQ_INSERT_TAIL(head, elm, field)
void Spinlock_Unlock(Spinlock *lock) __UNLOCK_EX(*lock)
void Spinlock_Lock(Spinlock *lock) __LOCK_EX(*lock)
◆ Semaphore_Destroy()
Definition at line 39 of file semaphore.c.
40{
44
46}
#define LIST_REMOVE(elm, field)
void Spinlock_Destroy(Spinlock *lock)
◆ Semaphore_Init()
void Semaphore_Init |
( |
Semaphore * |
sema, |
|
|
int |
count, |
|
|
const char * |
name |
|
) |
| |
◆ Semaphore_Release()
Definition at line 72 of file semaphore.c.
73{
75
78
79
84 }
86}
void Sched_SetRunnable(Thread *thr)
#define TAILQ_FIRST(head)
#define TAILQ_REMOVE(head, elm, field)
◆ Semaphore_TryAcquire()
Definition at line 89 of file semaphore.c.
90{
92 if (sema->
count > 0) {
95 return true;
96 }
98 return false;
99}