version 1.40, 2006/01/30 16:17:58
|
version 1.40.12.1, 2006/07/05 19:45:12
|
|
|
Uint32 _portNumber; | Uint32 _portNumber; |
SSLContext* _sslContext; | SSLContext* _sslContext; |
Monitor* _monitor; | Monitor* _monitor; |
|
Mutex _monitorMutex; |
HTTPAcceptor* _acceptor; | HTTPAcceptor* _acceptor; |
| |
Boolean _dieNow; | Boolean _dieNow; |
|
|
{ | { |
PEG_METHOD_ENTER(TRC_LISTENER, "CIMListenerService::shutdown()"); | PEG_METHOD_ENTER(TRC_LISTENER, "CIMListenerService::shutdown()"); |
| |
|
// This logic signals the thread currently executing _listener_routine() |
|
// to exit. That function deletes this instance of CIMListenerService, |
|
// which deletes the _monitor member. We use a mutex to keep it from |
|
// deleting the monitor until after tickle has been called. |
|
{ |
|
AutoMutex am(_monitorMutex); |
_dieNow = true; | _dieNow = true; |
_monitor->tickle(); | _monitor->tickle(); |
|
} |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
|
|
| |
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL CIMListenerService::_listener_routine(void *param) | PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL CIMListenerService::_listener_routine(void *param) |
{ | { |
|
CIMListenerService* svc = reinterpret_cast<CIMListenerService*>(param); |
|
|
try { | try { |
AutoPtr<CIMListenerService> svc(reinterpret_cast<CIMListenerService *>(param)); |
|
| |
//svc->init(); bug 1394 | //svc->init(); bug 1394 |
while(!svc->terminated()) | while(!svc->terminated()) |
|
|
Tracer::trace(TRC_SERVER, Tracer::LEVEL2, | Tracer::trace(TRC_SERVER, Tracer::LEVEL2, |
"Unknown exception thrown in _listener_routine."); | "Unknown exception thrown in _listener_routine."); |
} | } |
|
|
|
// CAUTION: deleting the service also deletes the monitor whose tickle() |
|
// method may still be executing in another thread. This line of code was |
|
// most likely reached when the CIMListenerService::shutdown() method set |
|
// _dieNow to true and called Monitor::tickle(). We must wait until we can |
|
// obtain the _monitorMutex, indicating that we are no longer inside |
|
// Monitor::ticle(). |
|
|
|
svc->_monitorMutex.lock(); |
|
svc->_monitorMutex.unlock(); |
|
delete svc; |
|
|
return 0; | return 0; |
} | } |
| |