sem.h

Go to the documentation of this file.
00001 
00047 #ifndef KERN_SEM_H
00048 #define KERN_SEM_H
00049 
00050 #include <cfg/compiler.h>
00051 #include <struct/list.h>
00052 
00053 /* Fwd decl */
00054 struct Process;
00055 
00056 
00057 typedef struct Semaphore
00058 {
00059     struct Process *owner;
00060     List            wait_queue;
00061     int             nest_count;
00062 } Semaphore;
00063 
00068 void sem_init(struct Semaphore *s);
00069 bool sem_attempt(struct Semaphore *s);
00070 void sem_obtain(struct Semaphore *s);
00071 void sem_release(struct Semaphore *s);
00072 /* \} */
00073 
00074 int sem_testRun(void);
00075 int sem_testSetup(void);
00076 int sem_testTearDown(void);
00077 
00078 #endif /* KERN_SEM_H */