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

Diff for /pegasus/src/Pegasus/Common/Thread.cpp between version 1.36.4.6 and 1.37

version 1.36.4.6, 2003/08/14 14:26:20 version 1.37, 2003/07/15 16:53:03
Line 44 
Line 44 
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
   
 void thread_data::default_delete(void * data) void thread_data::default_delete(void * data)
 { {
    if( data != NULL)    if( data != NULL)
Line 53 
Line 52 
  
 Boolean Thread::_signals_blocked = false; Boolean Thread::_signals_blocked = false;
 // l10n // l10n
   
   
 // l10n  
 PEGASUS_THREAD_KEY_TYPE Thread::_platform_thread_key; PEGASUS_THREAD_KEY_TYPE Thread::_platform_thread_key;
 Boolean Thread::_key_initialized = false; Boolean Thread::_key_initialized = false;
 Boolean Thread::_key_error = false;  
  
 // for non-native implementations // for non-native implementations
 #ifndef PEGASUS_THREAD_CLEANUP_NATIVE #ifndef PEGASUS_THREAD_CLEANUP_NATIVE
Line 124 
Line 120 
 #endif #endif
  
 // l10n start // l10n start
 Sint8 Thread::initializeKey()  
 {  
    PEG_METHOD_ENTER(TRC_THREAD, "Thread::initializeKey");  
    if (!Thread::_key_initialized)  
    {  
         if (Thread::_key_error)  
         {  
                 Tracer::trace(TRC_THREAD, Tracer::LEVEL4,  
                           "Thread: ERROR - thread key error");  
                 return -1;  
         }  
   
         if (pegasus_key_create(&Thread::_platform_thread_key) == 0)  
         {  
                 Tracer::trace(TRC_THREAD, Tracer::LEVEL4,  
                           "Thread: able to create a thread key");  
                 Thread::_key_initialized = true;  
         }  
         else  
         {  
                 Tracer::trace(TRC_THREAD, Tracer::LEVEL4,  
                           "Thread: ERROR - unable to create a thread key");  
                 Thread::_key_error = true;  
                 return -1;  
         }  
    }  
   
    PEG_METHOD_EXIT();  
    return 0;  
 }  
   
 Thread * Thread::getCurrent() Thread * Thread::getCurrent()
 { {
     PEG_METHOD_ENTER(TRC_THREAD, "Thread::getCurrent");      PEG_METHOD_ENTER(TRC_THREAD, "ThreadPool::getCurrent");
     if (Thread::initializeKey() != 0)          if (!Thread::_key_initialized)
     {  
         return NULL;         return NULL;
     }  
     PEG_METHOD_EXIT();  
     return (Thread *)pegasus_get_thread_specific(_platform_thread_key);     return (Thread *)pegasus_get_thread_specific(_platform_thread_key);
 } }
  
 void Thread::setCurrent(Thread * thrd)  
 {  
    PEG_METHOD_ENTER(TRC_THREAD, "Thread::setCurrent");  
    if (Thread::initializeKey() == 0)  
    {  
         if (pegasus_set_thread_specific(Thread::_platform_thread_key,  
                                                                  (void *) thrd) == 0)  
         {  
                 Tracer::trace(TRC_THREAD, Tracer::LEVEL4,  
                           "Successful set Thread * into thread specific storage");  
         }  
         else  
         {  
                 Tracer::trace(TRC_THREAD, Tracer::LEVEL4,  
                           "ERROR: got error setting Thread * into thread specific storage");  
         }  
    }  
    PEG_METHOD_EXIT();  
 }  
   
 AcceptLanguages * Thread::getLanguages() AcceptLanguages * Thread::getLanguages()
 { {
     PEG_METHOD_ENTER(TRC_THREAD, "Thread::getLanguages");      PEG_METHOD_ENTER(TRC_THREAD, "ThreadPool::getLanguages");
  
         Thread * curThrd = Thread::getCurrent();         Thread * curThrd = Thread::getCurrent();
         if (curThrd == NULL)         if (curThrd == NULL)
Line 202 
Line 144 
  
 void Thread::setLanguages(AcceptLanguages *langs) //l10n void Thread::setLanguages(AcceptLanguages *langs) //l10n
 { {
    PEG_METHOD_ENTER(TRC_THREAD, "Thread::setLanguages");     PEG_METHOD_ENTER(TRC_THREAD, "ThreadPool::setLanguages");
  
    Thread * currentThrd = Thread::getCurrent();    Thread * currentThrd = Thread::getCurrent();
    if (currentThrd != NULL)    if (currentThrd != NULL)
Line 219 
Line 161 
  
 void Thread::clearLanguages() //l10n void Thread::clearLanguages() //l10n
 { {
    PEG_METHOD_ENTER(TRC_THREAD, "Thread::clearLanguages");     PEG_METHOD_ENTER(TRC_THREAD, "ThreadPool::clearLanguages");
  
    Thread * currentThrd = Thread::getCurrent();    Thread * currentThrd = Thread::getCurrent();
    if (currentThrd != NULL)    if (currentThrd != NULL)
Line 293 
Line 235 
       _link_pool(_init_thread());       _link_pool(_init_thread());
    }    }
    _pools.insert_last(this);    _pools.insert_last(this);
   
      // l10n
      if (!Thread::_key_initialized)
      {
              pegasus_key_create(&Thread::_platform_thread_key);
              Thread::_key_initialized = true;
      }
 } }
  
  
Line 351 
Line 300 
    catch(...)    catch(...)
    {    {
    }    }
   
      // l10n
      pegasus_key_delete(Thread::_platform_thread_key);
 } }
  
 // make this static to the class // make this static to the class
Line 368 
Line 320 
 // l10n // l10n
    // Set myself into thread specific storage    // Set myself into thread specific storage
    // This will allow code to get its own Thread    // This will allow code to get its own Thread
    Thread::setCurrent(myself);     pegasus_set_thread_specific(Thread::_platform_thread_key, (void *) myself);
      Tracer::trace(TRC_THREAD, Tracer::LEVEL4,
             "just set myself into thread specific storage");
  
    ThreadPool *pool = (ThreadPool *)myself->get_parm();    ThreadPool *pool = (ThreadPool *)myself->get_parm();
    if(pool == 0 )    if(pool == 0 )


Legend:
Removed from v.1.36.4.6  
changed lines
  Added in v.1.37

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2