(file) Return to ThreadPool.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/ThreadPool.cpp between version 1.20 and 1.21

version 1.20, 2008/10/30 17:25:59 version 1.21, 2008/11/12 22:46:15
Line 138 
Line 138 
  
         try         try
         {         {
             sleep_sem = (Semaphore *) myself->reference_tsd("sleep sem");              sleep_sem = (Semaphore *) myself->reference_tsd(TSD_SLEEP_SEM);
             myself->dereference_tsd();             myself->dereference_tsd();
             PEGASUS_ASSERT(sleep_sem != 0);             PEGASUS_ASSERT(sleep_sem != 0);
  
             lastActivityTime =             lastActivityTime =
                 (struct timeval *) myself->                 (struct timeval *) myself->
                 reference_tsd("last activity time");                  reference_tsd(TSD_LAST_ACTIVITY_TIME);
             myself->dereference_tsd();             myself->dereference_tsd();
             PEGASUS_ASSERT(lastActivityTime != 0);             PEGASUS_ASSERT(lastActivityTime != 0);
         }         }
Line 187 
Line 187 
             try             try
             {             {
                 work = (ThreadReturnType(PEGASUS_THREAD_CDECL *) (void *))                 work = (ThreadReturnType(PEGASUS_THREAD_CDECL *) (void *))
                     myself->reference_tsd("work func");                      myself->reference_tsd(TSD_WORK_FUNC);
                 myself->dereference_tsd();                 myself->dereference_tsd();
                 workParm = myself->reference_tsd("work parm");                  workParm = myself->reference_tsd(TSD_WORK_PARM);
                 myself->dereference_tsd();                 myself->dereference_tsd();
                 blocking_sem =                 blocking_sem =
                     (Semaphore *) myself->reference_tsd("blocking sem");                      (Semaphore *) myself->reference_tsd(TSD_BLOCKING_SEM);
                 myself->dereference_tsd();                 myself->dereference_tsd();
             }             }
             catch (...)             catch (...)
Line 331 
Line 331 
             Threads::id(th->getThreadHandle().thid).buffer,             Threads::id(th->getThreadHandle().thid).buffer,
             parm));             parm));
  
         th->delete_tsd("work func");          th->delete_tsd(TSD_WORK_FUNC);
         th->put_tsd("work func", NULL,          th->put_tsd(TSD_WORK_FUNC, NULL,
                     sizeof (ThreadReturnType(PEGASUS_THREAD_CDECL *)                     sizeof (ThreadReturnType(PEGASUS_THREAD_CDECL *)
                             (void *)), (void *) work);                             (void *)), (void *) work);
         th->delete_tsd("work parm");          th->delete_tsd(TSD_WORK_PARM);
         th->put_tsd("work parm", NULL, sizeof (void *), parm);          th->put_tsd(TSD_WORK_PARM, NULL, sizeof (void *), parm);
         th->delete_tsd("blocking sem");          th->delete_tsd(TSD_BLOCKING_SEM);
         if (blocking != 0)         if (blocking != 0)
             th->put_tsd("blocking sem", NULL, sizeof (Semaphore *), blocking);              th->put_tsd(TSD_BLOCKING_SEM, NULL, sizeof (Semaphore *), blocking);
  
         // put the thread on the running list         // put the thread on the running list
         _runningThreads.insert_front(th);         _runningThreads.insert_front(th);
  
         // signal the thread's sleep semaphore to awaken it         // signal the thread's sleep semaphore to awaken it
         Semaphore *sleep_sem = (Semaphore *) th->reference_tsd("sleep sem");          Semaphore *sleep_sem = (Semaphore *) th->reference_tsd(TSD_SLEEP_SEM);
         PEGASUS_ASSERT(sleep_sem != 0);         PEGASUS_ASSERT(sleep_sem != 0);
  
         PEG_TRACE_CSTRING(TRC_THREAD, Tracer::LEVEL4,         PEG_TRACE_CSTRING(TRC_THREAD, Tracer::LEVEL4,
Line 392 
Line 392 
             break;             break;
         }         }
  
         void* tsd = 0;          void* tsd = thread->reference_tsd(TSD_LAST_ACTIVITY_TIME);
         if (!thread->try_reference_tsd("last activity time", &tsd))  
         {  
             PEGASUS_ASSERT(false);  
             _idleThreads.insert_back(thread);  
             break;  
         }  
         struct timeval *lastActivityTime =         struct timeval *lastActivityTime =
             reinterpret_cast<struct timeval*>(tsd);             reinterpret_cast<struct timeval*>(tsd);
         PEGASUS_ASSERT(lastActivityTime != 0);         PEGASUS_ASSERT(lastActivityTime != 0);
Line 427 
Line 421 
 { {
     PEG_METHOD_ENTER(TRC_THREAD, "ThreadPool::cleanupThread");     PEG_METHOD_ENTER(TRC_THREAD, "ThreadPool::cleanupThread");
  
     // Set the "work func" and "work parm" to 0 so _loop() knows to exit.      // Set the TSD_WORK_FUNC and TSD_WORK_PARM to 0 so _loop() knows to exit.
     thread->delete_tsd("work func");      thread->delete_tsd(TSD_WORK_FUNC);
     thread->put_tsd("work func", 0,      thread->put_tsd(TSD_WORK_FUNC, 0,
                     sizeof (ThreadReturnType(PEGASUS_THREAD_CDECL *)                     sizeof (ThreadReturnType(PEGASUS_THREAD_CDECL *)
                             (void *)), (void *) 0);                             (void *)), (void *) 0);
     thread->delete_tsd("work parm");      thread->delete_tsd(TSD_WORK_PARM);
     thread->put_tsd("work parm", 0, sizeof (void *), 0);      thread->put_tsd(TSD_WORK_PARM, 0, sizeof (void *), 0);
  
     // signal the thread's sleep semaphore to awaken it     // signal the thread's sleep semaphore to awaken it
     Semaphore *sleep_sem = (Semaphore *) thread->reference_tsd("sleep sem");      Semaphore *sleep_sem = (Semaphore *) thread->reference_tsd(TSD_SLEEP_SEM);
     PEGASUS_ASSERT(sleep_sem != 0);     PEGASUS_ASSERT(sleep_sem != 0);
     sleep_sem->signal();     sleep_sem->signal();
     thread->dereference_tsd();     thread->dereference_tsd();
Line 490 
Line 484 
     // 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(     th->put_tsd(
         "sleep sem", &_deleteSemaphore, sizeof(Semaphore), (void*) sleep_sem);          TSD_SLEEP_SEM, &_deleteSemaphore, sizeof(Semaphore), (void*) sleep_sem);
  
     struct timeval* lastActivityTime =     struct timeval* lastActivityTime =
         (struct timeval *)::operator  new(sizeof (struct timeval));         (struct timeval *)::operator  new(sizeof (struct timeval));
     Time::gettimeofday(lastActivityTime);     Time::gettimeofday(lastActivityTime);
  
     th->put_tsd(     th->put_tsd(
         "last activity time",          TSD_LAST_ACTIVITY_TIME,
         thread_data::default_delete,         thread_data::default_delete,
         sizeof(struct timeval),         sizeof(struct timeval),
         (void*) lastActivityTime);         (void*) lastActivityTime);


Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2