(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.17 and 1.18

version 1.17, 2002/06/01 00:56:40 version 1.18, 2002/06/07 00:03:34
Line 377 
Line 377 
    gettimeofday(&now, NULL);    gettimeofday(&now, NULL);
    Uint32 bodies = 0;    Uint32 bodies = 0;
  
   
    // first go thread the dead q and clean it up as much as possible    // first go thread the dead q and clean it up as much as possible
    while(_dead.count() > 0)    while(_dead.count() > 0)
    {    {
Line 417 
Line 416 
          {          {
             q->try_lock();             q->try_lock();
          }          }
          catch(AlreadyLocked &)           catch(...)
          {          {
             q++;              return bodies;
             continue;  
          }          }
  
          struct timeval dt = { 0, 0 };          struct timeval dt = { 0, 0 };
Line 433 
Line 431 
             {             {
                dtp = (struct timeval *)th->try_reference_tsd("deadlock timer");                dtp = (struct timeval *)th->try_reference_tsd("deadlock timer");
             }             }
             catch(AlreadyLocked &)              catch(...)
             {             {
                th = q->next(th);                 return bodies;
                continue;  
             }             }
  
             if(dtp != 0)             if(dtp != 0)
             {             {
                memcpy(&dt, dtp, sizeof(struct timeval));                memcpy(&dt, dtp, sizeof(struct timeval));
   
             }             }
             th->dereference_tsd();             th->dereference_tsd();
             struct timeval deadlock_timeout;             struct timeval deadlock_timeout;
             if( true == check_time(&dt, get_deadlock_detect(&deadlock_timeout) ))              Boolean too_long;
               if( i == 0)
               {
                  too_long = check_time(&dt, get_deallocate_wait(&deadlock_timeout));
               }
               else
               {
                  check_time(&dt, get_deadlock_detect(&deadlock_timeout));
               }
   
               if( true == too_long)
             {             {
                // if we are deallocating from the pool, escape if we are                // if we are deallocating from the pool, escape if we are
                // down to the minimum thread count                // down to the minimum thread count
                _current_threads--;                _current_threads--;
                if( _current_threads.value() <= (Uint32)_min_threads )                 if( _current_threads.value() < (Uint32)_min_threads )
                {                {
                   if( i == 0)                   if( i == 0)
                   {                   {
Line 472 
Line 478 
  
                if(th != 0)                if(th != 0)
                {                {
   
                   th->delete_tsd("work func");                   th->delete_tsd("work func");
                   th->put_tsd("work func", NULL,                   th->put_tsd("work func", NULL,
                               sizeof( PEGASUS_THREAD_RETURN (PEGASUS_THREAD_CDECL *)(void *)),                               sizeof( PEGASUS_THREAD_RETURN (PEGASUS_THREAD_CDECL *)(void *)),
Line 487 
Line 494 
                      th->dereference_tsd();                      th->dereference_tsd();
                      throw NullPointer();                      throw NullPointer();
                   }                   }
   
                   // put the thread on the dead  list                   // put the thread on the dead  list
                   _dead.insert_first(th);                   _dead.insert_first(th);
                   bodies++;                   bodies++;
Line 506 
Line 514 
          }          }
       }       }
    }    }
   
   
    return bodies;    return bodies;
 } }
  


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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2