CoreLinux++  0.4.32
GatewaySemaphore.hpp
1 #if !defined(__GATEWAYSEMAPHORE_HPP)
2 #define __GATEWAYSEMAPHORE_HPP
3 
4 /*
5  CoreLinux++
6  Copyright (C) 1999,2000 CoreLinux Consortium
7 
8  The CoreLinux++ Library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Library General Public License as
10  published by the Free Software Foundation; either version 2 of the
11  License, or (at your option) any later version.
12 
13  The CoreLinux++ Library Library is distributed in the hope that it will
14  be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Library General Public License for more details.
17 
18  You should have received a copy of the GNU Library General Public
19  License along with the GNU C Library; see the file COPYING.LIB. If not,
20  write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  Boston, MA 02111-1307, USA.
22 */
23 
24 #if !defined(__COMMON_HPP)
25 #include <Common.hpp>
26 #endif
27 
28 #if !defined(__SEMAPHORE_HPP)
29 #include <Semaphore.hpp>
30 #endif
31 
32 #if !defined(__MAP_HPP)
33 #include <Map.hpp>
34 #endif
35 
36 namespace corelinux
37 {
38  DECLARE_CLASS( GatewaySemaphore );
39 
40  CORELINUX_MAP
41  (
43  Count ,
44  std::less<ThreadIdentifier>,
45  GatewayClient
46  );
47 
72  class GatewaySemaphore : public Semaphore
73  {
74  public:
75 
76  //
77  // Constructors and destructors
78  //
79 
94  (
97  Count ,
98  bool Recursive = false,
99  bool Balking = false
100  ) throw ( NullPointerException );
101 
103 
104  virtual ~GatewaySemaphore( void );
105 
106  //
107  // Accessors
108  //
109 
111 
112  virtual bool isLocked( void );
113 
115 
116  virtual bool isAnOwner( void );
117 
124  virtual Counter getOwnerRecursionQueueLength( void );
125 
126 
127  //
128  // Mutators
129  //
130 
132 
134  throw( SemaphoreException );
135 
137 
139  throw( SemaphoreException );
140 
141 
143 
144  // virtual SemaphoreOperationStatus lockWithTimeOut( Timer )
145  // throw(SemaphoreException) = 0;
146 
148 
149  virtual SemaphoreOperationStatus release(void)
150  throw( SemaphoreException );
151 
152  protected:
153 
154  //
155  // Constructors
156  //
158 
159  GatewaySemaphore( void ) throw( Assertion );
160 
162 
164  throw( Assertion );
165 
166  //
167  // Operator overloads
168  //
170 
172  throw( Assertion );
173 
174  //
175  // Mutators
176  //
177 
178  SemaphoreOperationStatus lockAndAdd
179  (
180  ThreadIdentifierRef aTid,
181  Int aFlag = 0
182  );
183 
184 
185  private:
186 
188 
189  Count theMaxCount;
190 
192 
193  GatewayClient theClients;
194 
195  };
196 }
197 
198 #endif // if !defined(__GATEWAYSEMAPHORE_HPP)
199 /*
200  Common rcs information do not modify
201  $Author: prudhomm $
202  $Revision: 1.4 $
203  $Date: 2000/08/31 22:52:20 $
204  $Locker: $
205 */
206 
virtual Counter getOwnerRecursionQueueLength(void)
Returns the recursion depth for the calling thread.
Definition: GatewaySemaphore.cpp:134
virtual bool isAnOwner(void)
Returns true if calling thread owns a resource.
Definition: GatewaySemaphore.cpp:105
GatewaySemaphore(void)
Default construct throws assert.
Definition: GatewaySemaphore.cpp:39
virtual ~GatewaySemaphore(void)
Virtual Destructor.
Definition: GatewaySemaphore.cpp:86
GatewaySemphore enables a depth of resource indicator.
Definition: GatewaySemaphore.hpp:72
virtual bool isLocked(void)
Ask if AbstractSemaphore instance is locked.
Definition: GatewaySemaphore.cpp:95
SemaphoreOperationStatus
Semaphore method return enumeration.
Definition: AbstractSemaphore.hpp:39
NullPointerException is the base exception type for NullPointer.
Definition: NullPointerException.hpp:40
ScalarIdentifier provides a templated interface for declaring CoreLinux Identifiers for simple scalar...
Definition: ScalarIdentifiers.hpp:37
SemaphoreException is the base exception type for Semaphore.
Definition: SemaphoreException.hpp:39
A Semaphore supports the protocol that processes and/or threads agree to follow for the purpose of co...
Definition: Semaphore.hpp:61
Assertion is-a Exception created when an assertion fails.
Definition: Assertion.hpp:423
virtual SemaphoreOperationStatus release(void)
Request the AbstractSemaphore but timeout if not available.
Definition: GatewaySemaphore.cpp:409
virtual SemaphoreOperationStatus lockWithWait(void)
Request the lock, wait for availability.
Definition: GatewaySemaphore.cpp:155
virtual SemaphoreOperationStatus lockWithNoWait(void)
Request the lock without waiting.
Definition: GatewaySemaphore.cpp:282
A SemaphoreGroup is an extension to the Linux semaphore set.
Definition: SemaphoreGroup.hpp:62
GatewaySemaphoreRef operator=(GatewaySemaphoreCref)
Assignment operator throws assertion.

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