(file) Return to Thread.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/Thread.h between version 1.24 and 1.35

version 1.24, 2002/09/17 18:01:03 version 1.35, 2003/10/23 19:29:53
Line 1 
Line 1 
 //%/-*-c++-*-////////////////////////////////////////////////////////////////////////////  //%2003////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,  // Copyright (c) 2000, 2001, 2002  BMC Software, Hewlett-Packard Development
 // The Open Group, Tivoli Systems  // Company, L. P., IBM Corp., The Open Group, Tivoli Systems.
   // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.;
   // IBM Corp.; EMC Corporation, The Open Group.
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
Line 27 
Line 29 
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
   
 #ifndef Pegasus_Thread_h #ifndef Pegasus_Thread_h
 #define Pegasus_Thread_h #define Pegasus_Thread_h
   
   #include <cstring>
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
 #include <Pegasus/Common/IPC.h> #include <Pegasus/Common/IPC.h>
 #include <Pegasus/Common/InternalException.h> #include <Pegasus/Common/InternalException.h>
 #include <Pegasus/Common/DQueue.h> #include <Pegasus/Common/DQueue.h>
   #include <Pegasus/Common/AcceptLanguages.h>  // l10n
 #include <Pegasus/Common/Linkage.h> #include <Pegasus/Common/Linkage.h>
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
Line 205 
Line 209 
       void cancel(void);       void cancel(void);
  
       // cancel if there is a pending cancellation request       // cancel if there is a pending cancellation request
       static void test_cancel(void);        void test_cancel(void);
  
       Boolean is_cancelled(void);       Boolean is_cancelled(void);
  
Line 219 
Line 223 
  
       void thread_switch(void);       void thread_switch(void);
  
 #if defined(PEGASUS_PLATFORM_LINUX_IX86_GNU) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU)  #if defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU)
       // suspend this thread       // suspend this thread
       void suspend(void) ;       void suspend(void) ;
  
Line 235 
Line 239 
  
       // thread routine needs to call this function when       // thread routine needs to call this function when
       // it is ready to exit       // it is ready to exit
       static void exit_self(PEGASUS_THREAD_RETURN return_code) ;        void exit_self(PEGASUS_THREAD_RETURN return_code) ;
  
       // stack of functions to be called when thread terminates       // stack of functions to be called when thread terminates
       // will be called last in first out (LIFO)       // will be called last in first out (LIFO)
Line 296 
Line 300 
  
       inline void empty_tsd(void) throw(IPCException)       inline void empty_tsd(void) throw(IPCException)
       {       {
          thread_data* tsd;  
          while (0 != (tsd = _tsd.remove_first()))           try
            {
   
               _tsd.try_lock();
            }
            catch(IPCException&)
          {          {
               return;
            }
   
            thread_data* tsd = _tsd.next(0);
            while(tsd)
            {
               _tsd.remove_no_lock(tsd);
             delete tsd;             delete tsd;
               tsd = _tsd.next(0);
          }          }
          //_tsd.empty_list();           _tsd.unlock();
       }       }
  
       // create or re-initialize tsd associated with the key       // create or re-initialize tsd associated with the key
Line 337 
Line 354 
  
       void detach(void);       void detach(void);
  
         //
         //  Gets the Thread object associated with the caller's thread.
         //  Note: this may return NULL if no Thread object is associated
         //  with the caller's thread.
         //
         static Thread * getCurrent();  // l10n
   
         //
         //  Sets the Thread object associated with the caller's thread.
         //  Note: the Thread object must be placed on the heap.
         //
         static void setCurrent(Thread * thrd); // l10n
   
         //
         //  Gets the AcceptLanguages object associated with the caller's
         //  Thread.
         //  Note: this may return NULL if no Thread object, or no
         //  AcceptLanguages object, is associated with the caller's thread.
         //
         static AcceptLanguages * getLanguages(); //l10n
   
         //
         //  Sets the AcceptLanguages object associated with the caller's
         //  Thread.
         //  Note: a Thread object must have been previously associated with
         //  the caller's thread.
         //  Note: the AcceptLanguages object must be placed on the heap.
         //
         static void setLanguages(AcceptLanguages *langs); //l10n
   
         //
         //  Removes the AcceptLanguages object associated with the caller's
         //  Thread.
         //
         static void clearLanguages(); //l10n
   
    private:    private:
       Thread();       Thread();
   
         static Sint8 initializeKey();  // l10n
   
       inline void create_tsd(const Sint8 *key ) throw(IPCException)       inline void create_tsd(const Sint8 *key ) throw(IPCException)
       {       {
          thread_data *tsd = new thread_data(key);          thread_data *tsd = new thread_data(key);
Line 362 
Line 418 
       void *_thread_parm;       void *_thread_parm;
       PEGASUS_THREAD_RETURN _exit_code;       PEGASUS_THREAD_RETURN _exit_code;
       static Boolean _signals_blocked;       static Boolean _signals_blocked;
         static PEGASUS_THREAD_KEY_TYPE _platform_thread_key;  //l10n
         static Boolean _key_initialized; // l10n
         static Boolean _key_error; // l10n
       friend class ThreadPool;       friend class ThreadPool;
 } ; } ;
  
Line 512 
Line 571 
       DQueue<Thread> _running;       DQueue<Thread> _running;
       DQueue<Thread> _dead;       DQueue<Thread> _dead;
       AtomicInt _dying;       AtomicInt _dying;
   
       static void _sleep_sem_del(void *p);       static void _sleep_sem_del(void *p);
  
       void _check_deadlock(struct timeval *start) throw(Deadlock);       void _check_deadlock(struct timeval *start) throw(Deadlock);


Legend:
Removed from v.1.24  
changed lines
  Added in v.1.35

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2