(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.18 and 1.19

version 1.18, 2002/06/07 00:03:34 version 1.19, 2002/06/07 15:17:13
Line 152 
Line 152 
  
 ThreadPool::~ThreadPool(void) ThreadPool::~ThreadPool(void)
 { {
   
    _dying++;    _dying++;
    Thread *th = 0;    Thread *th = 0;
    th = _pool.remove_first();    th = _pool.remove_first();
Line 289 
Line 290 
          PEG_METHOD_EXIT();          PEG_METHOD_EXIT();
          myself->exit_self(0);          myself->exit_self(0);
       }       }
   
    }    }
    // wait to be awakend by the thread pool destructor    // wait to be awakend by the thread pool destructor
    sleep_sem->wait();    sleep_sem->wait();
Line 552 
Line 554 
 } }
  
  
    void ThreadPool::_sleep_sem_del(void *p)
   {
      if(p != 0)
      {
         delete (Semaphore *)p;
      }
   }
   
    void ThreadPool::_check_deadlock(struct timeval *start) throw(Deadlock)
   {
      if (true == check_time(start, &_deadlock_detect))
         throw Deadlock(pegasus_thread_self());
      return;
   }
   
   
    Boolean ThreadPool::_check_deadlock_no_throw(struct timeval *start)
   {
      return(check_time(start, &_deadlock_detect));
   }
   
    Boolean ThreadPool::_check_dealloc(struct timeval *start)
   {
      return(check_time(start, &_deallocate_wait));
   }
   
    Thread *ThreadPool::_init_thread(void) throw(IPCException)
   {
      Thread *th = (Thread *) new Thread(_loop, this, false);
      // allocate a sleep semaphore and pass it in the thread context
      // initial count is zero, loop function will sleep until
      // we signal the semaphore
      Semaphore *sleep_sem = (Semaphore *) new Semaphore(0);
      th->put_tsd("sleep sem", &_sleep_sem_del, sizeof(Semaphore), (void *)sleep_sem);
   
      struct timeval *dldt = (struct timeval *) ::operator new(sizeof(struct timeval));
      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
      th->run();
      _current_threads++;
      pegasus_yield();
   
      return th;
   }
   
    void ThreadPool::_link_pool(Thread *th) throw(IPCException)
   {
      if(th == 0)
         throw NullPointer();
      _pool.insert_first(th);
   }
   
   
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END
  


Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2