00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 2 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * This program is distributed in the hope that it will be useful, 00008 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00009 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00010 * GNU General Public License for more details. 00011 * 00012 * You should have received a copy of the GNU General Public License 00013 * along with this program; if not, write to the Free Software 00014 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00015 * 00016 * (c)Copyright 2006 Hewlett-Packard Development Company, LP. 00017 * 00018 */ 00019 00020 // C_Semaphore class definition 00021 00022 #ifndef _C_SEMAPHORE 00023 #define _C_SEMAPHORE 00024 00025 #define T_CounterValue int 00026 #define COUNTER_INIT_VALUE 1 00027 #define COUNTER_COMP_VALUE 0 00028 00029 class C_Semaphore { 00030 00031 public: 00032 T_CounterValue P(); // P: blocks while <=0 (signaled) and then -- 00033 T_CounterValue V(); // V: ++ and signal the change 00034 C_Semaphore() ; 00035 ~C_Semaphore() ; 00036 00037 protected: 00038 void init(); // internal init of the semaphore => system calls 00039 void destroy(); // internal destroy of the semaphore => system calls 00040 void *m_impl; // semaphore data structure 00041 00042 } ; 00043 00044 #endif // _C_SEMAPHORE