diff options
author | Benoit Foucher <benoit@zeroc.com> | 2009-12-01 14:02:05 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2009-12-01 14:02:05 +0100 |
commit | cd63c3e37dde04051fb2f4631f788bed7b48937b (patch) | |
tree | ae2c581bd228ec42c6eb46bf83a88f1174623bac /cpp/src/Ice/ThreadPool.cpp | |
parent | SLES RPM fixes (diff) | |
download | ice-cd63c3e37dde04051fb2f4631f788bed7b48937b.tar.bz2 ice-cd63c3e37dde04051fb2f4631f788bed7b48937b.tar.xz ice-cd63c3e37dde04051fb2f4631f788bed7b48937b.zip |
Added support for Ice::Dispatcher
Diffstat (limited to 'cpp/src/Ice/ThreadPool.cpp')
-rw-r--r-- | cpp/src/Ice/ThreadPool.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp index ec61063885b..a2867bb727e 100644 --- a/cpp/src/Ice/ThreadPool.cpp +++ b/cpp/src/Ice/ThreadPool.cpp @@ -112,6 +112,44 @@ class ThreadPoolDestroyedException } +IceInternal::DispatchWorkItem::DispatchWorkItem(const InstancePtr& instance) : _instance(instance) +{ +} + +void +IceInternal::DispatchWorkItem::execute(ThreadPoolCurrent& current) +{ + Ice::DispatcherPtr dispatcher = _instance->initializationData().dispatcher; + if(dispatcher) + { + try + { + dispatcher->dispatch(this, 0); + } + catch(const std::exception& ex) + { + if(_instance->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1) + { + Warning out(_instance->initializationData().logger); + out << "dispatch exception:\n" << ex; + } + } + catch(...) + { + if(_instance->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1) + { + Warning out(_instance->initializationData().logger); + out << "dispatch exception:\nunknown c++ exception"; + } + } + } + else + { + current.ioCompleted(); // Promote a follower. + run(); + } +} + IceInternal::ThreadPoolWorkQueue::ThreadPoolWorkQueue(ThreadPool* threadPool, const InstancePtr& instance, Selector& selector) : |