• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

ibrcommon/ibrcommon/thread/Semaphore.cpp

Go to the documentation of this file.
00001 #include "ibrcommon/config.h"
00002 #include "ibrcommon/thread/Semaphore.h"
00003 #include <iostream>
00004 
00005 using namespace std;
00006 
00007 namespace ibrcommon
00008 {
00009         Semaphore::Semaphore(unsigned int value)
00010         {
00011                 sem_init(&count_sem, 0, value);
00012 
00013         }
00014 
00015         Semaphore::~Semaphore()
00016         {
00017                 sem_destroy(&count_sem);
00018         }
00019 
00020         void Semaphore::wait()
00021         {
00022                 sem_wait(&count_sem);
00023         }
00024 
00025         void Semaphore::post()
00026         {
00027                 sem_post(&count_sem);
00028         }
00029 }

Generated on Wed Mar 30 2011 11:11:49 for IBR-DTNSuite by  doxygen 1.7.1