*** empty log message ***

git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@332 29311d96-e01e-0410-9327-a35deaab8ce9
This commit is contained in:
sbrandt 2005-06-22 04:44:26 +00:00
parent 94ade9d913
commit 057aaef5d4

37
ceph/common/Semaphore.h Normal file
View File

@ -0,0 +1,37 @@
#ifndef _Sem_Posix_
#define _Sem_Posix_
#include <cassert>
class Semaphore
{
Mutex m;
Cond c;
int count;
public:
Semaphore()
{
count = 0;
}
void Put() {
m.Lock();
count++;
c.Signal();
m.Unlock();
}
void Get()
{
m.Lock();
while(count <= 0) {
C.Wait(m);
}
count--;
m.Unlock();
}
};
#endif // !_Mutex_Posix_