version 1.11, 2002/05/22 05:25:30
|
version 1.12, 2002/05/23 20:11:56
|
|
|
| |
Boolean Monitor::run(Uint32 milliseconds) | Boolean Monitor::run(Uint32 milliseconds) |
{ | { |
|
|
|
|
// register the monitor as a module to gain access to the cimserver's thread pool | // register the monitor as a module to gain access to the cimserver's thread pool |
// <<< Wed May 15 09:52:16 2002 mdd >>> | // <<< Wed May 15 09:52:16 2002 mdd >>> |
while(_module_handle == NULL) | while(_module_handle == NULL) |
{ | { |
|
|
try | try |
{ | { |
|
|
_controller = &(ModuleController::register_module(PEGASUS_QUEUENAME_CONTROLSERVICE, | _controller = &(ModuleController::register_module(PEGASUS_QUEUENAME_CONTROLSERVICE, |
PEGASUS_MODULENAME_MONITOR, | PEGASUS_MODULENAME_MONITOR, |
(void *)this, | (void *)this, |
|
|
0, | 0, |
0, | 0, |
&_module_handle)); | &_module_handle)); |
break; |
|
| |
} | } |
catch( ... ) |
catch(IncompatibleTypes &) |
{ | { |
; |
ModuleController* controlService = |
|
new ModuleController(PEGASUS_QUEUENAME_CONTROLSERVICE); |
|
} |
|
catch( AlreadyExists & ) |
|
{ |
|
break; |
} | } |
} | } |
|
|
| |
#ifdef PEGASUS_OS_TYPE_WINDOWS | #ifdef PEGASUS_OS_TYPE_WINDOWS |
| |
|
|
{ | { |
| |
MessageQueue *q = MessageQueue::lookup(_entries[i].queueId); | MessageQueue *q = MessageQueue::lookup(_entries[i].queueId); |
if(q && static_cast<HTTPConnection *>(q)->is_dying()) |
if(q && static_cast<HTTPConnection *>(q)->is_dying() && |
|
(0 == static_cast<HTTPConnection *>(q)->refcount.value())) |
{ | { |
static_cast<HTTPConnection *>(q)->lock_connection(); | static_cast<HTTPConnection *>(q)->lock_connection(); |
static_cast<HTTPConnection *>(q)->unlock_connection(); | static_cast<HTTPConnection *>(q)->unlock_connection(); |
|
|
| |
if(_entries[i]._type == Monitor::CONNECTION) | if(_entries[i]._type == Monitor::CONNECTION) |
{ | { |
|
if( 0 == static_cast<HTTPConnection *>(queue)->refcount.value()) |
|
{ |
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()) |
_controller->async_thread_exec(*_module_handle, _dispatch, (void *)queue); | _controller->async_thread_exec(*_module_handle, _dispatch, (void *)queue); |
else | else |
static_cast<HTTPConnection *>(queue)->refcount--; | static_cast<HTTPConnection *>(queue)->refcount--; |
} | } |
|
} |
else | else |
{ | { |
Message* message = new SocketMessage(socket, events); | Message* message = new SocketMessage(socket, events); |
|
|
_entries.append(entry); | _entries.append(entry); |
| |
// Success! | // Success! |
// ATTN-RK-P2-20020521: Why do we need this? |
|
ModuleController* controlService = |
|
new ModuleController(PEGASUS_QUEUENAME_CONTROLSERVICE); |
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return true; | return true; |
} | } |
|
|
dst->refcount--; | dst->refcount--; |
return 0; | return 0; |
} | } |
dst->lock_connection(); |
|
if( false == dst->is_dying()) | if( false == dst->is_dying()) |
|
{ |
dst->run(1); | dst->run(1); |
|
} |
dst->refcount--; | dst->refcount--; |
dst->unlock_connection(); |
|
|
|
return 0; | return 0; |
} | } |
| |