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

Thread.hpp

00001 #if !defined(__THREAD_HPP) 00002 #define __THREAD_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 Thread.hpp is included by Common.hpp only. 00026 #endif 00027 00028 #if !defined(__SINGLETON_HPP) 00029 #include <Singleton.hpp> 00030 #endif 00031 00032 #if !defined(__MAP_HPP) 00033 #include <Map.hpp> 00034 #endif 00035 00036 #if !defined(__INVALIDTHREADEXCEPTION_HPP) 00037 #include <InvalidThreadException.hpp> 00038 #endif 00039 00040 namespace corelinux 00041 { 00042 DECLARE_CLASS( ThreadContext ); 00043 00044 CORELINUX_MAP 00045 ( 00046 ThreadIdentifier, 00047 ThreadContextPtr, 00048 std::less<ThreadIdentifier>, 00049 ThreadMap 00050 ); 00051 00052 // 00053 // Start of class declaration 00054 // 00055 00056 DECLARE_CLASS( Thread ); 00057 DECLARE_TYPE( Singleton<Thread>, ThreadManager ); 00058 00073 class Thread : public Synchronized 00074 { 00075 public: 00076 00077 // 00078 // Constructors and destructor 00079 // 00080 00082 00083 Thread( void ) throw( Assertion ); 00084 00086 00087 virtual ~Thread( void ); 00088 00089 // 00090 // Operator overloads 00091 // 00092 00093 // 00094 // Accessors (class) 00095 // 00096 00103 static Int getKernelError( void ); 00104 00111 static ThreadIdentifier getThreadIdentifier( void ); 00112 00119 static ThreadIdentifier getParentThreadIdentifier( void ); 00120 00127 static ThreadIdentifierCref getThreadManagerIdentifier( void ); 00128 00137 static ThreadContextCref getThreadContext( ThreadIdentifierCref ) 00138 throw ( InvalidThreadException ) ; 00139 00140 00146 static Count getCreatedThreadCount( void ); 00147 00153 static Count getActiveThreadCount( void ); 00154 00160 static Count getBlockedThreadCount( void ); 00161 00168 static Count getCompletedThreadCount( void ); 00169 00171 00172 static void dump( void ); 00173 00174 // 00175 // Mutators 00176 // 00177 00187 static ThreadIdentifier startThread( ThreadContextRef ) ; 00188 00199 static Int waitForThread( ThreadIdentifierCref ) 00200 throw ( InvalidThreadException ); 00201 00211 static void destroyThreadContext( ThreadIdentifierCref ) 00212 throw ( InvalidThreadException, Assertion ); 00213 00223 static Int getThreadPriority( ThreadIdentifierCref ) 00224 throw ( InvalidThreadException, Assertion ); 00225 00236 static void setThreadPriority( ThreadIdentifierCref, Int ) 00237 throw ( InvalidThreadException, Assertion ); 00238 00239 protected: 00240 00241 // 00242 // Constructor 00243 // 00250 Thread( ThreadCref ) throw ( Assertion ); 00251 00252 // 00253 // Operator overloads 00254 // 00255 00264 ThreadRef operator=( ThreadCref ) throw ( Assertion ); 00265 00273 bool operator==( ThreadCref ) const throw ( Assertion ) ; 00274 00275 // 00276 // Thread terminate 00277 // 00278 00279 static void threadTerminated( Int, VoidPtr, VoidPtr ); 00280 00281 protected: 00282 00284 00285 static ThreadManager theThreadManager; 00286 00287 private: 00288 00290 00291 static ThreadMap theThreadMap; 00292 00293 static ThreadIdentifier theThreadManagerId; 00294 static Count theThreadCount; 00295 }; 00296 00297 } 00298 00299 #endif // if !defined(__THREAD_HPP) 00300 00301 /* 00302 Common rcs information do not modify 00303 $Author: dulimart $ 00304 $Revision: 1.5 $ 00305 $Date: 2001/03/20 04:06:50 $ 00306 $Locker: $ 00307 */ 00308

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