Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Examples

Semaphore.hpp

00001 #if !defined(__SEMAPHORE_HPP) 00002 #define __SEMAPHORE_HPP 00003 00004 /* 00005 CoreLinux++ 00006 Copyright (C) 1999,2000 CoreLinux Consortium 00007 00008 The CoreLinux++ Library is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU Library General Public License as 00010 published by the Free Software Foundation; either version 2 of the 00011 License, or (at your option) any later version. 00012 00013 The CoreLinux++ Library Library is distributed in the hope that it will 00014 be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Library General Public License for more details. 00017 00018 You should have received a copy of the GNU Library General Public 00019 License along with the GNU C Library; see the file COPYING.LIB. If not, 00020 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00021 Boston, MA 02111-1307, USA. 00022 */ 00023 00024 #if !defined(__COMMON_HPP) 00025 #include <Common.hpp> 00026 #endif 00027 00028 #if !defined(__ABSTRACTSEMAPHORE_HPP) 00029 #include <AbstractSemaphore.hpp> 00030 #endif 00031 00032 #if !defined(__SEMAPHOREEXCEPTION_HPP) 00033 #include <SemaphoreException.hpp> 00034 #endif 00035 00036 namespace corelinux 00037 { 00038 00039 DECLARE_CLASS( Semaphore ); 00040 00061 class Semaphore : public AbstractSemaphore 00062 { 00063 00064 public: 00065 00066 00067 // 00068 // Constructors and destructors 00069 // 00070 00082 Semaphore 00083 ( 00084 SemaphoreGroupPtr, 00085 SemaphoreIdentifierRef, 00086 bool Recursive=false, 00087 bool Balking=false 00088 ) throw ( NullPointerException ); 00089 00091 00092 virtual ~Semaphore( void ); 00093 00094 // 00095 // Operator overloads 00096 // 00097 00099 00100 bool operator==( SemaphoreCref aRef ) const; 00101 00102 // 00103 // Accessors 00104 // 00105 00107 00108 virtual bool isBalkingEnabled( void ) const; 00109 00111 00112 virtual bool isRecursionEnabled( void ) const; 00113 00115 00116 virtual ThreadIdentifierCref getOwningThreadIdentifier( void ) const; 00117 00119 00120 virtual CounterCref getRecursionQueueLength( void ) const; 00121 00122 00123 protected: 00124 00125 // 00126 // Constructors 00127 // 00128 00130 00131 Semaphore( void ) 00132 throw(Assertion); 00133 00135 00136 Semaphore( SemaphoreCref ) 00137 throw(Assertion); 00138 00139 // 00140 // Operator overloads 00141 // 00143 00144 SemaphoreRef operator=( SemaphoreCref ) 00145 throw(Assertion); 00146 00148 00149 CounterCref operator++( void ); 00150 00152 00153 CounterCref operator--( void ); 00154 00155 // 00156 // Accessors 00157 // 00158 00160 00161 virtual ThreadIdentifierRef getOwnerId( void ); 00162 00163 // 00164 // Mutators 00165 // 00166 00168 00169 virtual void setOwnerId( void ); 00170 00172 00173 virtual void setRecursionQueueLength( Counter ); 00174 00176 00177 virtual void resetOwnerId( void ); 00178 00179 00180 private: 00181 00183 00184 ThreadIdentifier theOwningThread; 00185 00187 00188 Counter theRecursionQueueLength; 00189 00191 00192 bool theRecursiveMode; 00193 00195 00196 bool theBalkingMode; 00197 00198 }; 00199 } 00200 00201 #endif // if !defined(__SEMAPHORE_HPP) 00202 00203 /* 00204 Common rcs information do not modify 00205 $Author: frankc $ 00206 $Revision: 1.2 $ 00207 $Date: 2000/06/02 11:51:52 $ 00208 $Locker: $ 00209 */ 00210

This is the CoreLinux++ reference manual
Provided by The CoreLinux Consortium