CoreLinux++  0.4.32
MutexSemaphore.hpp
1 #if !defined(__MUTEXSEMAPHORE_HPP)
2 #define __MUTEXSEMAPHORE_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( MutexSemaphore );
35 
51  class MutexSemaphore : public Semaphore
52  {
53  public:
54 
55  //
56  // Constructors and destructors
57  //
58 
72  (
75  bool AutoLock = false,
76  bool Recursive = true,
77  bool Balking = false
78  ) throw ( NullPointerException );
79 
81 
82  virtual ~MutexSemaphore( void );
83 
84  //
85  // Accessors
86  //
87 
89 
90  virtual bool isLocked( void ) ;
91 
92  //
93  // Mutators
94  //
95 
97 
98  virtual SemaphoreOperationStatus lockWithWait( void )
99  throw(SemaphoreException);
100 
102 
104  throw(SemaphoreException);
105 
107 
108 // virtual SemaphoreOperationStatus lockWithTimeOut( Timer )
109 // throw(SemaphoreException) = 0;
110 
112 
113  virtual SemaphoreOperationStatus release( void )
114  throw(SemaphoreException);
115 
116 
117  protected:
118 
119  //
120  // Constructors
121  //
123 
124  MutexSemaphore( void ) throw( Assertion );
125 
127 
129  throw( Assertion );
130 
131  //
132  // Operator overloads
133  //
135 
137  throw( Assertion );
138 
139  private:
140 
141  };
142 
143 }
144 
145 #endif // if !defined(__MUTEXSEMAPHORE_HPP)
146 
147 /*
148  Common rcs information do not modify
149  $Author: frankc $
150  $Revision: 1.2 $
151  $Date: 2000/06/02 11:51:52 $
152  $Locker: $
153 */
154 
155 
virtual SemaphoreOperationStatus lockWithWait(void)
Request the semaphore, wait for availability.
Definition: MutexSemaphore.cpp:108
MutexSemaphore implements a mutual exclusion control which can be used to insure that at most one (1)...
Definition: MutexSemaphore.hpp:51
virtual bool isLocked(void)
Ask if semaphore instance is locked.
Definition: MutexSemaphore.cpp:99
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
MutexSemaphore(void)
Default construct throws assert.
Definition: MutexSemaphore.cpp:39
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 ~MutexSemaphore(void)
Virtual Destructor.
Definition: MutexSemaphore.cpp:90
virtual SemaphoreOperationStatus lockWithNoWait(void)
Request the semaphore without waiting.
Definition: MutexSemaphore.cpp:190
MutexSemaphoreRef operator=(MutexSemaphoreCref)
Assignment operator throws assertion.
virtual SemaphoreOperationStatus release(void)
Request the semaphore but timeout if not available.
Definition: MutexSemaphore.cpp:256
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