(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.38 and 1.39

version 1.38, 2003/07/22 16:39:19 version 1.39, 2003/08/04 19:20:53
Line 120 
Line 120 
 #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 (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");
                   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();     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 145 
Line 190 
  
 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 162 
Line 207 
  
 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 236 
Line 281 
       _link_pool(_init_thread());       _link_pool(_init_thread());
    }    }
    _pools.insert_last(this);    _pools.insert_last(this);
   
    // l10n  
    if (!Thread::_key_initialized)  
    {  
         if (pegasus_key_create(&Thread::_platform_thread_key) == 0)  
         {  
                 Tracer::trace(TRC_THREAD, Tracer::LEVEL4,  
                           "ThreadPool: able to create a thread key");  
                 Thread::_key_initialized = true;  
         }  
         else  
         {  
                 Tracer::trace(TRC_THREAD, Tracer::LEVEL4,  
                           "ThreadPool: ERROR - unable to create a thread key");  
 printf("ThreadPool: ERROR - unable to create a thread key\n");  
         }  
    }  
 } }
  
  
Line 328 
Line 356 
 // 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
    if (Thread::_key_initialized)     Thread::setCurrent(myself);
    {  
         if (pegasus_set_thread_specific(Thread::_platform_thread_key,  
                                                                  (void *) myself) == 0)  
         {  
                 Tracer::trace(TRC_THREAD, Tracer::LEVEL4,  
                           "just set myself into thread specific storage");  
         }  
         else  
         {  
 printf("ThreadPool: ERROR setting tls\n");  
                 Tracer::trace(TRC_THREAD, Tracer::LEVEL4,  
                           "ERROR: got error setting thread specific storage");  
         }  
    }  
    else  
    {  
         Tracer::trace(TRC_THREAD, Tracer::LEVEL4,  
                   "ERROR: thread key is not initialized");  
    }  
  
    ThreadPool *pool = (ThreadPool *)myself->get_parm();    ThreadPool *pool = (ThreadPool *)myself->get_parm();
    if(pool == 0 )    if(pool == 0 )


Legend:
Removed from v.1.38  
changed lines
  Added in v.1.39

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2