(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.1 and 1.36.4.6

version 1.36.4.1, 2003/07/16 21:45:25 version 1.36.4.6, 2003/08/14 14:26:20
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 52 
Line 53 
  
 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 120 
Line 124 
 #endif #endif
  
 // l10n start // l10n start
 Thread * Thread::getCurrent()  Sint8 Thread::initializeKey()
 { {
     PEG_METHOD_ENTER(TRC_THREAD, "ThreadPool::getCurrent");     PEG_METHOD_ENTER(TRC_THREAD, "Thread::initializeKey");
         if (!Thread::_key_initialized)         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()
   {
       PEG_METHOD_ENTER(TRC_THREAD, "Thread::getCurrent");
       if (Thread::initializeKey() != 0)
       {
                 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, "ThreadPool::getLanguages");      PEG_METHOD_ENTER(TRC_THREAD, "Thread::getLanguages");
  
         Thread * curThrd = Thread::getCurrent();         Thread * curThrd = Thread::getCurrent();
         if (curThrd == NULL)         if (curThrd == NULL)
Line 144 
Line 202 
  
 void Thread::setLanguages(AcceptLanguages *langs) //l10n void Thread::setLanguages(AcceptLanguages *langs) //l10n
 { {
    PEG_METHOD_ENTER(TRC_THREAD, "ThreadPool::setLanguages");     PEG_METHOD_ENTER(TRC_THREAD, "Thread::setLanguages");
  
    Thread * currentThrd = Thread::getCurrent();    Thread * currentThrd = Thread::getCurrent();
    if (currentThrd != NULL)    if (currentThrd != NULL)
Line 161 
Line 219 
  
 void Thread::clearLanguages() //l10n void Thread::clearLanguages() //l10n
 { {
    PEG_METHOD_ENTER(TRC_THREAD, "ThreadPool::clearLanguages");     PEG_METHOD_ENTER(TRC_THREAD, "Thread::clearLanguages");
  
    Thread * currentThrd = Thread::getCurrent();    Thread * currentThrd = Thread::getCurrent();
    if (currentThrd != NULL)    if (currentThrd != NULL)
Line 235 
Line 293 
       _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 300 
Line 351 
    catch(...)    catch(...)
    {    {
    }    }
   
    // l10n  
    pegasus_key_delete(Thread::_platform_thread_key);  
 } }
  
 // make this static to the class // make this static to the class
Line 320 
Line 368 
 // 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
    pegasus_set_thread_specific(Thread::_platform_thread_key, (void *) myself);     Thread::setCurrent(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.1  
changed lines
  Added in v.1.36.4.6

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2