version 1.18, 2002/06/07 00:03:34
|
version 1.19, 2002/06/07 15:17:13
|
|
|
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
| |
static struct timeval create_time = {0, 50}; |
static struct timeval create_time = {0, 10}; |
static struct timeval destroy_time = {2, 0}; |
static struct timeval destroy_time = {5, 0}; |
static struct timeval deadlock_time = {10, 0}; |
static struct timeval deadlock_time = {100, 0}; |
|
|
ThreadPool Monitor::_thread_pool(0, "Monitor", 0, 20, |
|
create_time, destroy_time, deadlock_time); |
|
| |
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
// | // |
|
|
FD_ZERO(&_rep->active_rd_fd_set); | FD_ZERO(&_rep->active_rd_fd_set); |
FD_ZERO(&_rep->active_wr_fd_set); | FD_ZERO(&_rep->active_wr_fd_set); |
FD_ZERO(&_rep->active_ex_fd_set); | FD_ZERO(&_rep->active_ex_fd_set); |
|
if( _async == true ) |
|
{ |
|
_thread_pool = new ThreadPool(0, |
|
"Monitor", |
|
0, |
|
20, |
|
create_time, |
|
destroy_time, |
|
deadlock_time); |
|
} |
|
|
} | } |
Monitor::~Monitor() | Monitor::~Monitor() |
{ | { |
|
|
Socket::uninitializeInterface(); | Socket::uninitializeInterface(); |
Tracer::trace(TRC_HTTP, Tracer::LEVEL4, | Tracer::trace(TRC_HTTP, Tracer::LEVEL4, |
"returning from monitor destructor"); | "returning from monitor destructor"); |
|
delete _thread_pool; |
} | } |
| |
| |
|
|
if( now.tv_sec - last.tv_sec > 0 ) | if( now.tv_sec - last.tv_sec > 0 ) |
{ | { |
gettimeofday(&last, NULL); | gettimeofday(&last, NULL); |
return _thread_pool.kill_dead_threads(); |
return _thread_pool->kill_dead_threads(); |
} | } |
return 0; | return 0; |
} | } |
|
|
| |
static_cast<HTTPConnection *>(queue)->refcount++; | static_cast<HTTPConnection *>(queue)->refcount++; |
if( false == static_cast<HTTPConnection *>(queue)->is_dying()) | if( false == static_cast<HTTPConnection *>(queue)->is_dying()) |
_thread_pool.allocate_and_awaken((void *)queue, _dispatch); |
_thread_pool->allocate_and_awaken((void *)queue, _dispatch); |
else | else |
static_cast<HTTPConnection *>(queue)->refcount--; | static_cast<HTTPConnection *>(queue)->refcount--; |
} | } |