version 1.61, 2002/06/25 16:13:42
|
version 1.62, 2002/07/12 23:10:04
|
|
|
| |
DQueue<MessageQueueService> MessageQueueService::_polling_list(true); | DQueue<MessageQueueService> MessageQueueService::_polling_list(true); |
| |
void MessageQueueService::_exit_routine(void) |
Thread* MessageQueueService::_polling_thread = 0; |
{ |
|
_stop_polling = 1; |
|
_polling_sem.signal(); |
|
|
|
} |
|
| |
| |
int MessageQueueService::kill_idle_threads(void) | int MessageQueueService::kill_idle_threads(void) |
|
|
_polling_sem.wait(); | _polling_sem.wait(); |
if(_stop_polling.value() != 0 ) | if(_stop_polling.value() != 0 ) |
{ | { |
list->unlock(); |
break; |
myself->exit_self((PEGASUS_THREAD_RETURN) 1 ); |
|
} | } |
| |
list->lock(); | list->lock(); |
|
|
return(0); | return(0); |
} | } |
| |
Thread MessageQueueService::_polling_thread(polling_routine, |
|
reinterpret_cast<void *>(&_polling_list), |
|
false); |
|
|
|
| |
Semaphore MessageQueueService::_polling_sem(0); | Semaphore MessageQueueService::_polling_sem(0); |
AtomicInt MessageQueueService::_stop_polling(0); | AtomicInt MessageQueueService::_stop_polling(0); |
|
|
} | } |
_thread_pool = new ThreadPool(0, "MessageQueueService", 0, 0, | _thread_pool = new ThreadPool(0, "MessageQueueService", 0, 0, |
create_time, destroy_time, deadlock_time); | create_time, destroy_time, deadlock_time); |
atexit(_exit_routine); |
|
| |
_polling_thread.run(); |
_polling_thread = new Thread(polling_routine, |
|
reinterpret_cast<void *>(&_polling_list), |
|
false); |
|
_polling_thread->run(); |
} | } |
_service_count++; | _service_count++; |
| |
|
|
{ | { |
_stop_polling++; | _stop_polling++; |
_polling_sem.signal(); | _polling_sem.signal(); |
_polling_thread.join(); |
_polling_thread->join(); |
|
delete _polling_thread; |
_meta_dispatcher->_shutdown_routed_queue(); | _meta_dispatcher->_shutdown_routed_queue(); |
delete _meta_dispatcher; | delete _meta_dispatcher; |
_meta_dispatcher = 0; | _meta_dispatcher = 0; |
|
|
} | } |
_meta_dispatcher_mutex.unlock(); | _meta_dispatcher_mutex.unlock(); |
_polling_list.remove(this); | _polling_list.remove(this); |
_polling_sem.signal(); |
|
} | } |
| |
void MessageQueueService::_shutdown_incoming_queue(void) | void MessageQueueService::_shutdown_incoming_queue(void) |