Mercurial > hg > Game > Cerium
annotate TaskManager/kernel/ppe/Sem.h @ 1531:4443d59a8210 draft
SDL.h in main.cc
author | yuhi@cr.ie.u-ryukyu.ac.jp |
---|---|
date | Fri, 07 Dec 2012 15:46:27 +0900 |
parents | 4c209dd223cd |
children | f73ca57cdc81 |
rev | line source |
---|---|
1180 | 1 #ifndef INCLUDED_SEM |
2 #define INCLUDED_SEM | |
3 | |
4 #include <pthread.h> | |
5 | |
6 typedef struct sem_t { | |
7 volatile int value; //セマフォ変数 | |
8 pthread_mutex_t mutex; //セマフォ操作用のロック | |
9 pthread_cond_t cond; //待ち合わせ用の条件変数 | |
10 } sem_t, *sem_ptr; | |
11 | |
12 class Sem { | |
13 public: | |
14 /* constructor */ | |
15 Sem(int value); | |
16 ~Sem(); | |
17 void sem_p(); | |
18 void sem_v(); | |
1186 | 19 int count(); |
1180 | 20 /* variables */ |
21 private: | |
22 sem_t *sem; | |
23 }; | |
24 | |
25 typedef Sem *SemPtr; | |
26 | |
27 #endif /* INCLUDED_SEM */ |