CoreLinux++  0.4.32
EventSemaphore.hpp
1 #if !defined(__EVENTSEMAPHORE_HPP)
2 #define __EVENTSEMAPHORE_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 namespace corelinux
33 {
34  DECLARE_CLASS( EventSemaphore );
35 
41  class EventSemaphore : public Semaphore
42  {
43  public:
44 
45  //
46  // Constructors and destructors
47  //
48 
63  (
64  SemaphoreGroupPtr aGroup,
65  SemaphoreIdentifierRef aIdentifier,
66  Counter aLimit,
67  bool aRecursionFlag = true,
68  bool aBalkingFlag = false
69  ) throw ( NullPointerException );
70 
72 
73  virtual ~EventSemaphore( void );
74 
75  //
76  // Accessors
77  //
78 
80 
81  virtual bool isLocked( void ) ;
82 
83  //
84  // Mutators
85  //
86 
92  throw( SemaphoreException );
93 
99  virtual SemaphoreOperationStatus lockWithWait( void )
100  throw( SemaphoreException );
101 
107  throw( SemaphoreException );
108 
110 
111 // virtual SemaphoreOperationStatus lockWithTimeOut( Timer )
112 // throw(SemaphoreException) = 0;
113 
115 
116  virtual SemaphoreOperationStatus release( void )
117  throw( SemaphoreException );
118 
127  virtual void setLimit ( Counter aLimit ) throw ( SemaphoreException );
128 
133  virtual Counter getLimit ( void ) const;
134 
135  protected:
136 
137  //
138  // Constructors
139  //
141 
142  EventSemaphore( void ) throw( Assertion );
143 
145 
147 
148  //
149  // Operator overloads
150  //
152 
154  throw( Assertion );
155 
156  private:
157 
159 
160  Counter theNumListeners;
161 
163 
164  Counter theMaxListeners;
165  };
166 
167 }
168 
169 #endif // if !defined(__EVENTSEMAPHORE_HPP)
170 
171 /*
172  Common rcs information do not modify
173  $Author: dulimart $
174  $Revision: 1.7 $
175  $Date: 2000/11/15 22:32:06 $
176  $Locker: $
177 */
178 
179 
EventSemaphore(void)
Default constructor throws assert.
Definition: EventSemaphore.cpp:41
virtual bool isLocked(void)
Check if semaphore instance is locked.
Definition: EventSemaphore.cpp:93
virtual ~EventSemaphore(void)
Virtual Destructor.
Definition: EventSemaphore.cpp:84
EventSemaphore implements a way to queue its caller until a certain event takes place.
Definition: EventSemaphore.hpp:41
virtual Counter getLimit(void) const
Get the maximum number of listeners of this semaphore.
Definition: EventSemaphore.cpp:292
SemaphoreOperationStatus
Semaphore method return enumeration.
Definition: AbstractSemaphore.hpp:39
SemaphoreOperationStatus post(void)
Indicate owner commitment to trigger the event after a finite amount of time.
Definition: EventSemaphore.cpp:102
virtual SemaphoreOperationStatus lockWithWait(void)
Wait for the event associated with this semaphore to take place.
Definition: EventSemaphore.cpp:134
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
virtual SemaphoreOperationStatus release(void)
Request the semaphore but timeout if not available.
Definition: EventSemaphore.cpp:251
Assertion is-a Exception created when an assertion fails.
Definition: Assertion.hpp:423
EventSemaphoreRef operator=(EventSemaphoreCref)
Assignment operator throws assertion.
virtual SemaphoreOperationStatus lockWithNoWait(void)
Check if the associated event has taken place.
Definition: EventSemaphore.cpp:193
virtual void setLimit(Counter aLimit)
Set the maximum number of listeners allowed on this semaphore.
Definition: EventSemaphore.cpp:270
A SemaphoreGroup is an extension to the Linux semaphore set.
Definition: SemaphoreGroup.hpp:62

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