(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.21 and 1.27

version 1.21, 2002/06/19 22:06:33 version 1.27, 2002/09/17 18:01:03
Line 306 
Line 306 
          PEG_METHOD_EXIT();          PEG_METHOD_EXIT();
          throw NullPointer();          throw NullPointer();
       }       }
   
         if(_work ==
            (PEGASUS_THREAD_RETURN (PEGASUS_THREAD_CDECL *)(void *)) &_undertaker)
         {
            _work(parm);
         }
   
       gettimeofday(deadlock_timer, NULL);       gettimeofday(deadlock_timer, NULL);
       try       try
       {       {
Line 330 
Line 337 
          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 451 
Line 457 
    int i = 0;    int i = 0;
    AtomicInt needed(0);    AtomicInt needed(0);
  
   //   for( ; i < 2; i++) << Fri Sep 13 12:49:46 2002 mdd >>
   // This change prevents the thread pool from killing hung threads.
   // The definition of a hung thread is one that has been on the run queue for too long.
   // "too long" is defined as a time interval that is set when the thread pool is created.
   // Cancelling "hung" threads has proved to be problematic.
   
   // With this change the thread pool will not cancel hung threads. This may prevent a
   // crash depending upon the state of the hung thread. It will cause the thread to hang
   // around and not do anything besides waste space.
   
   // Idle threads, those that have not executed a routine for a time interval, continue to be
   // destroyed. This is normal and should not cause any problems.
   
    for( ; i < 1; i++)    for( ; i < 1; i++)
    {    {
       q = map[i];       q = map[i];
Line 477 
Line 496 
             }             }
             catch(...)             catch(...)
             {             {
                  q->unlock();
                return bodies;                return bodies;
             }             }
  
Line 493 
Line 513 
             }             }
             else             else
             {             {
                check_time(&dt, get_deadlock_detect(&deadlock_timeout));                 too_long = check_time(&dt, get_deadlock_detect(&deadlock_timeout));
             }             }
  
             if( true == too_long)             if( true == too_long)
Line 535 
Line 555 
  
                   if(sleep_sem == 0)                   if(sleep_sem == 0)
                   {                   {
                        q->unlock();
                      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++;
                   sleep_sem->signal();                   sleep_sem->signal();
  
Line 566 
Line 587 
  
 Boolean ThreadPool::check_time(struct timeval *start, struct timeval *interval) Boolean ThreadPool::check_time(struct timeval *start, struct timeval *interval)
 { {
      // never time out if the interval is zero
      if(interval && interval->tv_sec == 0 && interval->tv_usec == 0)
         return false;
   
    struct timeval now, finish, remaining;    struct timeval now, finish, remaining;
    Uint32 usec;    Uint32 usec;
    gettimeofday(&now, NULL);    gettimeofday(&now, NULL);
Line 591 
Line 616 
       myself->detach();       myself->detach();
       myself->_handle.thid = 0;       myself->_handle.thid = 0;
       myself->cancel();       myself->cancel();
       myself->test_cancel();        delete myself;
       myself->exit_self(0);        Thread::test_cancel();
         Thread::exit_self(0);
    }    }
    return((PEGASUS_THREAD_RETURN)0);    return((PEGASUS_THREAD_RETURN)0);
 } }


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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2