version 1.13, 2006/04/18 19:08:43
|
version 1.14, 2006/07/11 18:39:33
|
|
|
#include <Pegasus/Common/XmlParser.h> | #include <Pegasus/Common/XmlParser.h> |
#include <Pegasus/Common/XmlWriter.h> | #include <Pegasus/Common/XmlWriter.h> |
#include <Pegasus/Common/IPC.h> | #include <Pegasus/Common/IPC.h> |
|
#include <Pegasus/Common/List.h> |
|
#include <Pegasus/Common/RecursiveMutex.h> |
| |
#include "ConsumerManager.h" | #include "ConsumerManager.h" |
| |
|
|
| |
DynamicConsumer* myself = static_cast<DynamicConsumer*>(param); | DynamicConsumer* myself = static_cast<DynamicConsumer*>(param); |
String name = myself->getName(); | String name = myself->getName(); |
DQueue<IndicationDispatchEvent> tmpEventQueue(true); |
List<IndicationDispatchEvent,RecursiveMutex> tmpEventQueue; |
| |
PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL2, "_worker_routine::entering loop for " + name); | PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL2, "_worker_routine::entering loop for " + name); |
| |
|
|
} | } |
| |
//create a temporary queue to store failed indications | //create a temporary queue to store failed indications |
tmpEventQueue.empty_list(); |
tmpEventQueue.clear(); |
| |
//continue processing events until the queue is empty | //continue processing events until the queue is empty |
//make sure to check for the shutdown signal before every iteration | //make sure to check for the shutdown signal before every iteration |
|
|
| |
//pop next indication off the queue | //pop next indication off the queue |
IndicationDispatchEvent* event = 0; | IndicationDispatchEvent* event = 0; |
event = myself->_eventqueue.remove_first(); //what exceptions/errors can this throw? |
event = myself->_eventqueue.remove_front(); //what exceptions/errors can this throw? |
| |
if (!event) | if (!event) |
{ | { |
|
|
} else | } else |
{ | { |
PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL4, "_worker_routine::placing failed indication back in queue"); | PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL4, "_worker_routine::placing failed indication back in queue"); |
tmpEventQueue.insert_last(event); |
tmpEventQueue.insert_back(event); |
} | } |
| |
} else | } else |
|
|
myself->_eventqueue.try_lock(); | myself->_eventqueue.try_lock(); |
while (tmpEventQueue.size()) | while (tmpEventQueue.size()) |
{ | { |
//there is no = operator for DQueue so we must do it manually |
tmpEvent = tmpEventQueue.remove_front(); |
tmpEvent = tmpEventQueue.remove_first(); |
myself->_eventqueue.insert_back(tmpEvent); |
myself->_eventqueue.insert_last_no_lock(tmpEvent); |
|
| |
} | } |
myself->_eventqueue.unlock(); | myself->_eventqueue.unlock(); |