(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.7 and 1.8

version 1.7, 2002/02/26 18:46:44 version 1.8, 2002/03/18 11:34:28
Line 158 
Line 158 
             return(true);             return(true);
          return(false);          return(false);
       }       }
   
       inline Boolean operator==(const thread_data& b) const       inline Boolean operator==(const thread_data& b) const
       {       {
          return(operator==((const void *)b._key));          return(operator==((const void *)b._key));
Line 374 
Line 375 
                                PEGASUS_THREAD_RETURN (PEGASUS_THREAD_CDECL *work)(void *))                                PEGASUS_THREAD_RETURN (PEGASUS_THREAD_CDECL *work)(void *))
          throw(IPCException);          throw(IPCException);
  
       void kill_dead_threads( void )        void allocate_and_awaken(void *parm,
                                  PEGASUS_THREAD_RETURN (PEGASUS_THREAD_CDECL *work)(void *),
                                  Semaphore *blocking_sem)
            throw(IPCException);
   
   
         Uint32 kill_dead_threads( void )
          throw(IPCException);          throw(IPCException);
  
       void get_key(Sint8 *buf, int bufsize);       void get_key(Sint8 *buf, int bufsize);
Line 471 
Line 478 
       struct timeval _deallocate_wait;       struct timeval _deallocate_wait;
       struct timeval _deadlock_detect;       struct timeval _deadlock_detect;
       static PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL _loop(void *);       static PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL _loop(void *);
       Semaphore _waiters;  
       Sint8 _key[17];       Sint8 _key[17];
       Semaphore _pool_sem;  
       DQueue<Thread> _pool;       DQueue<Thread> _pool;
       DQueue<Thread> _running;       DQueue<Thread> _running;
       DQueue<Thread> _dead;       DQueue<Thread> _dead;
Line 520 
Line 525 
  
 inline Thread *ThreadPool::_init_thread(void) throw(IPCException) inline Thread *ThreadPool::_init_thread(void) throw(IPCException)
 { {
    Thread *th = (Thread *) new Thread(&_loop, this, false);     Thread *th = (Thread *) new Thread(_loop, this, false);
    // allocate a sleep semaphore and pass it in the thread context    // allocate a sleep semaphore and pass it in the thread context
    // initial count is zero, loop function will sleep until    // initial count is zero, loop function will sleep until
    // we signal the semaphore    // we signal the semaphore
    Semaphore *sleep_sem = (Semaphore *) new Semaphore(0);    Semaphore *sleep_sem = (Semaphore *) new Semaphore(0);
    th->put_tsd("sleep sem", &_sleep_sem_del, sizeof(Semaphore), (void *)sleep_sem);    th->put_tsd("sleep sem", &_sleep_sem_del, sizeof(Semaphore), (void *)sleep_sem);
   
    struct timeval *dldt = (struct timeval *) ::operator new(sizeof(struct timeval));    struct timeval *dldt = (struct timeval *) ::operator new(sizeof(struct timeval));
    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();
   
    return th;    return th;
 } }
  
Line 539 
Line 547 
    if(th == 0)    if(th == 0)
       throw NullPointer();       throw NullPointer();
    _pool.insert_first(th);    _pool.insert_first(th);
    _pool_sem.signal();  
 } }
  
  


Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2