(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 and 1.36.4.1

version 1.36, 2003/04/16 00:17:14 version 1.36.4.1, 2003/07/16 21:45:25
Line 51 
Line 51 
 } }
  
 Boolean Thread::_signals_blocked = false; Boolean Thread::_signals_blocked = false;
   // l10n
   PEGASUS_THREAD_KEY_TYPE Thread::_platform_thread_key;
   Boolean Thread::_key_initialized = false;
   
  
 // for non-native implementations // for non-native implementations
 #ifndef PEGASUS_THREAD_CLEANUP_NATIVE #ifndef PEGASUS_THREAD_CLEANUP_NATIVE
Line 115 
Line 119 
  
 #endif #endif
  
   // l10n start
   Thread * Thread::getCurrent()
   {
       PEG_METHOD_ENTER(TRC_THREAD, "ThreadPool::getCurrent");
           if (!Thread::_key_initialized)
                   return NULL;
           return (Thread *)pegasus_get_thread_specific(_platform_thread_key);
   }
   
   AcceptLanguages * Thread::getLanguages()
   {
       PEG_METHOD_ENTER(TRC_THREAD, "ThreadPool::getLanguages");
   
           Thread * curThrd = Thread::getCurrent();
           if (curThrd == NULL)
                   return NULL;
           AcceptLanguages * acceptLangs =
                    (AcceptLanguages *)curThrd->reference_tsd("acceptLanguages");
           curThrd->dereference_tsd();
       PEG_METHOD_EXIT();
           return acceptLangs;
   }
   
   void Thread::setLanguages(AcceptLanguages *langs) //l10n
   {
      PEG_METHOD_ENTER(TRC_THREAD, "ThreadPool::setLanguages");
   
      Thread * currentThrd = Thread::getCurrent();
      if (currentThrd != NULL)
      {
                   // deletes the old tsd and creates a new one
                   currentThrd->put_tsd("acceptLanguages",
                           thread_data::default_delete,
                           sizeof(AcceptLanguages *),
                           langs);
      }
   
      PEG_METHOD_EXIT();
   }
   
   void Thread::clearLanguages() //l10n
   {
      PEG_METHOD_ENTER(TRC_THREAD, "ThreadPool::clearLanguages");
   
      Thread * currentThrd = Thread::getCurrent();
      if (currentThrd != NULL)
      {
                   // deletes the old tsd
                   currentThrd->delete_tsd("acceptLanguages");
      }
   
      PEG_METHOD_EXIT();
   }
   // l10n end
   
 DQueue<ThreadPool> ThreadPool::_pools(true); DQueue<ThreadPool> ThreadPool::_pools(true);
  
  
Line 177 
Line 236 
    }    }
    _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 235 
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 248 
Line 316 
       PEG_METHOD_EXIT();       PEG_METHOD_EXIT();
       throw NullPointer();       throw NullPointer();
    }    }
   
   // l10n
      // Set myself into thread specific storage
      // This will allow code to get its own Thread
      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 )
    {    {
Line 332 
Line 408 
       {       {
          gettimeofday(deadlock_timer, NULL);          gettimeofday(deadlock_timer, NULL);
       }       }
   
       gettimeofday(deadlock_timer, NULL);       gettimeofday(deadlock_timer, NULL);
       if( blocking_sem != 0 )       if( blocking_sem != 0 )
          blocking_sem->signal();          blocking_sem->signal();
Line 667 
Line 744 
  
    th->put_tsd("deadlock timer", thread_data::default_delete, sizeof(struct timeval), (void *)dldt);    th->put_tsd("deadlock timer", thread_data::default_delete, sizeof(struct timeval), (void *)dldt);
    // thread will enter _loop(void *) and sleep on sleep_sem until we signal it    // thread will enter _loop(void *) and sleep on sleep_sem until we signal it
   
    th->run();    th->run();
    _current_threads++;    _current_threads++;
    pegasus_yield();    pegasus_yield();
Line 682 
Line 760 
 } }
  
  
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END
  


Legend:
Removed from v.1.36  
changed lines
  Added in v.1.36.4.1

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2