version 1.30, 2003/02/13 14:53:10
|
version 1.31, 2003/02/20 01:42:26
|
|
|
// 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) |
{ | { |
|
#if !defined(PEGASUS_PLATFORM_HPUX_ACC) && !defined(PEGASUS_PLATFORM_LINUX_IA64_GNU) |
PEGASUS_STD(cout) << "ThreadPool:: removing and joining dead thread" << PEGASUS_STD(endl); | PEGASUS_STD(cout) << "ThreadPool:: removing and joining dead thread" << PEGASUS_STD(endl); |
|
#endif |
Thread *dead = _dead.remove_first(); | Thread *dead = _dead.remove_first(); |
if(dead == 0) | if(dead == 0) |
throw NullPointer(); | throw NullPointer(); |
|
|
int i = 0; | int i = 0; |
AtomicInt needed(0); | AtomicInt needed(0); |
| |
|
#ifdef PEGASUS_DISABLE_KILLING_HUNG_THREADS |
|
// 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 longer than the time interval set when the thread pool was created. |
|
// Cancelling "hung" threads has proven 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. In |
|
// the case that the thread is actually hung, this change causes the |
|
// thread resources not to be reclaimed. |
|
|
|
// 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++) |
|
#else |
for( ; i < 2; i++) | for( ; i < 2; i++) |
|
#endif |
{ | { |
q = map[i]; | q = map[i]; |
if(q->count() > 0 ) | if(q->count() > 0 ) |
|
|
else | else |
{ | { |
// deadlocked threads | // deadlocked threads |
|
#if !defined(PEGASUS_PLATFORM_HPUX_ACC) && !defined(PEGASUS_PLATFORM_LINUX_IA64_GNU) |
PEGASUS_STD(cout) << "Killing a deadlocked thread" << PEGASUS_STD(endl); | PEGASUS_STD(cout) << "Killing a deadlocked thread" << PEGASUS_STD(endl); |
|
#endif |
th->cancel(); | th->cancel(); |
delete th; | delete th; |
} | } |