wait_queue.h
上传用户:shtangtang
上传日期:2007-01-04
资源大小:167k
文件大小:1k
- #ifndef __THREAD_WAIT_QUEUE_H
- #define __THREAD_WAIT_QUEUE_H
- #include <thread_spinlock.h>
- #include <thread_attributes.h>
- #define __THREAD_QUEUE_MAX 64
- class wait_queue {
- private:
- int w_id;
- attributes::scope w_scope;
- struct storage {
- int w_magic;
- short top,bottom;
- spinlock w_sync;
- int pid[__THREAD_QUEUE_MAX];
- } *_wq;
- void init(attributes::scope);
- public:
- wait_queue(int);
- wait_queue(attributes::scope);
- wait_queue();
- ~wait_queue();
- bool empty();
- void insert(int);
- void remove(int);
- void suspend_me();
- void wake_up();
- };
- #endif /* __THREAD_WAIT_QUEUE_H */