Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound 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 getActiveThreadCount( void );
00147 
00154       static   Count getCompletedThreadCount( void );
00155 
00157 
00158       static   void dump( void );
00159 
00160       //
00161       // Mutators
00162       //
00163 
00173       static   ThreadIdentifier  startThread( ThreadContextRef ) ;
00174                   
00185       static   Int   waitForThread( ThreadIdentifierCref ) 
00186                   throw ( InvalidThreadException );
00187 
00197       static   void     destroyThreadContext( ThreadIdentifierCref )
00198                   throw ( InvalidThreadException, Assertion );
00199 
00200    protected:
00201 
00202       //
00203       // Constructor
00204       //
00211                            Thread( ThreadCref ) throw ( Assertion );
00212 
00213       //
00214       // Operator overloads
00215       //
00216 
00225                ThreadRef   operator=( ThreadCref ) throw ( Assertion );
00226 
00234                bool operator==( ThreadCref ) const throw ( Assertion ) ;
00235 
00236       //
00237       // Thread terminate
00238       //
00239 
00240       static   void  threadTerminated( Int, VoidPtr, VoidPtr );
00241 
00242    protected:
00243 
00245 
00246       static   ThreadManager  theThreadManager;
00247 
00248    private:
00249 
00251 
00252       static   ThreadMap               theThreadMap;
00253 
00254       static   ThreadIdentifier        theThreadManagerId;
00255    };
00256 
00257 }
00258 
00259 #endif // if !defined(__THREAD_HPP)
00260 
00261 /*
00262    Common rcs information do not modify
00263    $Author: prudhomm $
00264    $Revision: 1.3 $
00265    $Date: 2000/08/31 22:52:20 $
00266    $Locker:  $
00267 */
00268 

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