#ifndef __KERN_SYNC_SEM_H__
|
|
#define __KERN_SYNC_SEM_H__
|
|
|
|
#include <defs.h>
|
|
#include <atomic.h>
|
|
#include <wait.h>
|
|
|
|
typedef struct {
|
|
int value;
|
|
wait_queue_t wait_queue;
|
|
} semaphore_t;
|
|
|
|
void sem_init(semaphore_t *sem, int value);
|
|
void up(semaphore_t *sem);
|
|
void down(semaphore_t *sem);
|
|
bool try_down(semaphore_t *sem);
|
|
|
|
#endif /* !__KERN_SYNC_SEM_H__ */
|
|
|