头文件:
#include <linux/semaphore.h>
定义:
/* Please don't access any members of this structure directly */
struct semaphore {
spinlock_t lock;
unsigned int count;
struct list_head wait_list;
};
初始化:
void sema_init(struct semaphore *sem,int val);
P函数:
void down(struct seamphore *sem)
int down_interruptible(struct seamphore *sem)
int down_trylock(struct seamphore *sem)
V函数:
void up(struct seamphore *sem)