diff options
author | Marc Laukien <marc@zeroc.com> | 2002-04-19 12:52:54 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2002-04-19 12:52:54 +0000 |
commit | 54e2ad2824426b33f2bdc9e1aa178a1fdbfe1bdc (patch) | |
tree | 7fec1c9e7d38cafdda0ca055980c74a1fbd86857 /cpp/src/Ice/ThreadPool.cpp | |
parent | lock upgrade (diff) | |
download | ice-54e2ad2824426b33f2bdc9e1aa178a1fdbfe1bdc.tar.bz2 ice-54e2ad2824426b33f2bdc9e1aa178a1fdbfe1bdc.tar.xz ice-54e2ad2824426b33f2bdc9e1aa178a1fdbfe1bdc.zip |
minor change
Diffstat (limited to 'cpp/src/Ice/ThreadPool.cpp')
-rw-r--r-- | cpp/src/Ice/ThreadPool.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp index 07dedbead26..2619576b546 100644 --- a/cpp/src/Ice/ThreadPool.cpp +++ b/cpp/src/Ice/ThreadPool.cpp @@ -46,7 +46,10 @@ IceInternal::ThreadPool::unregister(SOCKET fd) void IceInternal::ThreadPool::promoteFollower() { - _threadMutex.unlock(); + if (_multipleThreads) + { + _threadMutex.unlock(); + } } void @@ -97,7 +100,8 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, bool server) : _destroyed(false), _lastFd(INVALID_SOCKET), _handlers(0), - _timeout(0) + _timeout(0), + _multipleThreads(false) { SOCKET fds[2]; createPipe(fds); @@ -125,6 +129,11 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, bool server) : _threadNum = 1; } + if (_threadNum > 1) + { + _multipleThreads = true; + } + try { for (int i = 0 ; i < _threadNum ; ++i) @@ -236,7 +245,10 @@ IceInternal::ThreadPool::run() while (true) { - _threadMutex.lock(); + if (_multipleThreads) + { + _threadMutex.lock(); + } repeatSelect: |