sem.h
上传用户:shmaik
上传日期:2014-06-01
资源大小:45093k
文件大小:0k
- /* $Id: H:/drh/idioms/book/RCS/thread.doc,v 1.11 1997/02/21 19:50:51 drh Exp $ */
- #ifndef SEM_INCLUDED
- #define SEM_INCLUDED
- #define T Sem_T
- typedef struct T {
- int count;
- void *queue;
- } T;
- #define LOCK(mutex) do { Sem_T *_yymutex = &(mutex);
- Sem_wait(_yymutex);
- #define END_LOCK Sem_signal(_yymutex); } while (0)
- extern void Sem_init (T *s, int count);
- extern T *Sem_new (int count);
- extern void Sem_wait (T *s);
- extern void Sem_signal(T *s);
- #undef T
- #endif