00001
00002 #ifndef _SEMAPHORE_H_
00003 #define _SEMAPHORE_H_
00004
00005 #include <stdio.h>
00006 #include <pthread.h>
00007 #include <sys/errno.h>
00008
00009 class Semaphore
00010 {
00011 private:
00012 pthread_mutex_t mutex;
00013 int waitcount;
00014 int postcount;
00015
00016 public:
00017 Semaphore();
00018 ~Semaphore();
00019
00021 bool isBusy();
00022
00024 int Wait();
00025
00027 int Post();
00028
00030 int WaitCount();
00031
00033 int PostCount();
00034 };
00035
00036 #endif // _SEMAPHORE_H_
00037