diff options
author | Joe Zhao <ztuowen@gmail.com> | 2014-04-14 08:14:45 +0800 |
---|---|---|
committer | Joe Zhao <ztuowen@gmail.com> | 2014-04-14 08:14:45 +0800 |
commit | cccccbf6cca94a3eaf813b4468453160e91c332b (patch) | |
tree | 23418cb73a10ae3b0688681a7f0ba9b06424583e /src/TNetLib/.svn/text-base/Semaphore.h.svn-base | |
download | tnet-cccccbf6cca94a3eaf813b4468453160e91c332b.tar.gz tnet-cccccbf6cca94a3eaf813b4468453160e91c332b.tar.bz2 tnet-cccccbf6cca94a3eaf813b4468453160e91c332b.zip |
First commit
Diffstat (limited to 'src/TNetLib/.svn/text-base/Semaphore.h.svn-base')
-rw-r--r-- | src/TNetLib/.svn/text-base/Semaphore.h.svn-base | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/TNetLib/.svn/text-base/Semaphore.h.svn-base b/src/TNetLib/.svn/text-base/Semaphore.h.svn-base new file mode 100644 index 0000000..a28ee44 --- /dev/null +++ b/src/TNetLib/.svn/text-base/Semaphore.h.svn-base @@ -0,0 +1,26 @@ +#ifndef _SEMPAHORE_H_ +#define _SEMPAHORE_H_ + +#include <pthread.h> + +namespace TNet { + + class Semaphore { + public: + Semaphore(int initValue = 0); + ~Semaphore(); + + int TryWait(); + void Wait(); + void Post(); + int GetValue(); + + private: + int mSemValue; + pthread_mutex_t mMutex; + pthread_cond_t mCond; + + }; +} //namespace + +#endif |