Semaphore.h

Go to the documentation of this file.
00001 /*
00002  * $Id: Semaphore.h 562 2007-12-02 08:04:16Z mindstorm2600 $
00003  *
00004  * X-VR2 
00005  * 
00006  * Copyright (C) Juan V. Guerrero 2007
00007  * 
00008  * Juan V. Guerrero <mindstorm2600@users.sourceforge.net>
00009  * 
00010  * This program is free software, distributed under the terms of
00011  * the GNU General Public License Version 2. See the LICENSE file
00012  * at the top of the source tree.
00013  */
00014 #ifndef __XVR2_SEMAPHORE_H__
00015 #define __XVR2_SEMAPHORE_H__
00016 
00017 #include<xvr2/Threading.h>
00018 #include<xvr2/CoreExceptions.h>
00019 #ifdef USE_POSIX_THREADS
00020 #include<semaphore.h>
00021 #endif
00022 
00023 namespace xvr2{
00028         class Semaphore:public Threading{
00029                 private:
00030 #ifdef USE_POSIX_THREADS
00031                         sem_t __sem;
00032 #endif
00033                 protected:
00034                         void init(int x);
00035                         void destroy();
00036                 public:
00037                         Semaphore(int x);
00038                         ~Semaphore();
00039                         void wait();
00040                         void trywait();
00041                         void post();
00042                         void getvalue(int *x);
00043         };
00044 }
00045 
00046 #endif

Generated on Fri Jun 20 22:55:47 2008 for X-VR2 SDK by  doxygen 1.5.5