summaryrefslogtreecommitdiff
path: root/src/TNetLib/.svn/text-base/Semaphore.h.svn-base
diff options
context:
space:
mode:
authorJoe Zhao <ztuowen@gmail.com>2014-04-14 08:14:45 +0800
committerJoe Zhao <ztuowen@gmail.com>2014-04-14 08:14:45 +0800
commitcccccbf6cca94a3eaf813b4468453160e91c332b (patch)
tree23418cb73a10ae3b0688681a7f0ba9b06424583e /src/TNetLib/.svn/text-base/Semaphore.h.svn-base
downloadtnet-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-base26
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