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

Synchronized.hpp

00001 #if !defined(__SYNCHRONIZED_HPP) 00002 #define __SYNCHRONIZED_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 IN_COMMON_HPP 00025 #error Synchronized.hpp is included by Common.hpp only. 00026 #endif 00027 00028 #if !defined(__SEMAPHOREEXCEPTION_HPP) 00029 #include <SemaphoreException.hpp> 00030 #endif 00031 00032 namespace corelinux 00033 { 00034 DECLARE_CLASS( Synchronized ); 00035 00041 class Synchronized 00042 { 00043 protected: 00044 00045 DECLARE_CLASS( Guard ); 00046 00053 class Guard 00054 { 00055 00056 public: 00057 00059 00060 Guard( GuardCref ); 00061 00062 00064 00065 ~Guard( void ); 00066 00067 00068 // 00069 // Mutator 00070 // 00071 00073 00074 void release( void ); 00075 00076 protected: 00077 00078 friend class Synchronized; 00079 00081 00082 Guard( SynchronizedPtr ); 00083 00085 00086 Guard( void ); 00087 00089 00090 GuardRef operator=( GuardCref ); 00091 00092 private: 00093 00095 00096 mutable SynchronizedPtr theSynchronized; 00097 }; 00098 00099 public: 00100 00101 // 00102 // Constructors and destructor 00103 // 00104 00106 00107 Synchronized( void ); 00108 00110 00111 Synchronized( SynchronizedCref ); 00112 00114 00115 virtual ~Synchronized( void ); 00116 00117 // 00118 // Operator overloads 00119 // 00120 00122 00123 SynchronizedRef operator=( SynchronizedCref ); 00124 00126 00127 bool operator==( SynchronizedCref ) const; 00128 00129 protected: 00130 00131 // 00132 // Mutators 00133 // 00134 00141 Guard access( void ) const throw(SemaphoreException) ; 00142 00143 00144 }; 00145 00146 #define GUARD \ 00147 Guard aGuardedLock( this->access() ) 00148 } 00149 00150 00151 #endif // if !defined(__SYNCHRONIZED_HPP) 00152 00153 /* 00154 Common rcs information do not modify 00155 $Author: prudhomm $ 00156 $Revision: 1.4 $ 00157 $Date: 2000/08/31 22:52:20 $ 00158 $Locker: $ 00159 */ 00160

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