diff options
author | Joe George <joe@zeroc.com> | 2019-05-07 10:51:58 -0400 |
---|---|---|
committer | Joe George <joe@zeroc.com> | 2019-05-07 11:12:17 -0400 |
commit | 0199db0b81df4a37fe63069a9fc75e13d880e967 (patch) | |
tree | 48901929000d768d85f0eb350c60e99e962e4d38 /cpp/src/Ice/ThreadPool.cpp | |
parent | Regenerate Xcode projects (diff) | |
download | ice-0199db0b81df4a37fe63069a9fc75e13d880e967.tar.bz2 ice-0199db0b81df4a37fe63069a9fc75e13d880e967.tar.xz ice-0199db0b81df4a37fe63069a9fc75e13d880e967.zip |
Dispatch queue updates
- Remove dispatch queues from Swift APIs
- Create dispatch queue in C++ thread pool (ICE_SWIFT only)
Diffstat (limited to 'cpp/src/Ice/ThreadPool.cpp')
-rw-r--r-- | cpp/src/Ice/ThreadPool.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp index b836137170a..2994f292d86 100644 --- a/cpp/src/Ice/ThreadPool.cpp +++ b/cpp/src/Ice/ThreadPool.cpp @@ -245,7 +245,11 @@ IceInternal::ThreadPoolWorkQueue::getNativeInfo() IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& prefix, int timeout) : _instance(instance), +#ifdef ICE_SWIFT + _dispatchQueue(dispatch_queue_create(prefix.c_str(), DISPATCH_QUEUE_CONCURRENT)), +#else _dispatcher(_instance->initializationData().dispatcher), +#endif _destroyed(false), _prefix(prefix), _selector(instance), @@ -417,6 +421,9 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& p IceInternal::ThreadPool::~ThreadPool() { assert(_destroyed); +#ifdef ICE_SWIFT + dispatch_release(_dispatchQueue); +#endif } void @@ -531,6 +538,12 @@ IceInternal::ThreadPool::ready(const EventHandlerPtr& handler, SocketOperation o void IceInternal::ThreadPool::dispatchFromThisThread(const DispatchWorkItemPtr& workItem) { +#ifdef ICE_SWIFT + dispatch_sync(_dispatchQueue, ^ + { + workItem->run(); + }); +#else if(_dispatcher) { try @@ -566,6 +579,7 @@ IceInternal::ThreadPool::dispatchFromThisThread(const DispatchWorkItemPtr& workI { workItem->run(); } +#endif } void @@ -603,6 +617,16 @@ IceInternal::ThreadPool::prefix() const return _prefix; } +#ifdef ICE_SWIFT + +dispatch_queue_t +IceInternal::ThreadPool::getDispatchQueue() const +{ + return _dispatchQueue; +} + +#endif + void IceInternal::ThreadPool::run(const EventHandlerThreadPtr& thread) { |