diff options
author | Marc Laukien <marc@zeroc.com> | 2001-08-25 00:51:19 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2001-08-25 00:51:19 +0000 |
commit | 92846d7f94cd8f5bd4a0ad0c88613938678ebb97 (patch) | |
tree | 169aed591278ad51d8f38f3c64cd85c5676c8402 /cpp/src/Ice/ThreadPool.cpp | |
parent | fixes (diff) | |
download | ice-92846d7f94cd8f5bd4a0ad0c88613938678ebb97.tar.bz2 ice-92846d7f94cd8f5bd4a0ad0c88613938678ebb97.tar.xz ice-92846d7f94cd8f5bd4a0ad0c88613938678ebb97.zip |
ThreadPool fixes; Win fixes
Diffstat (limited to 'cpp/src/Ice/ThreadPool.cpp')
-rw-r--r-- | cpp/src/Ice/ThreadPool.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp index d9adeb90dd2..5ccc0872ffb 100644 --- a/cpp/src/Ice/ThreadPool.cpp +++ b/cpp/src/Ice/ThreadPool.cpp @@ -116,6 +116,7 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance) : FD_ZERO(&_fdSet); FD_SET(_fdIntrRead, &_fdSet); _maxFd = _fdIntrRead; + _minFd = _fdIntrRead; try { @@ -261,13 +262,14 @@ IceInternal::ThreadPool::run() if (!_adds.empty()) { // - // New handlers have been added + // New handlers have been addedf // for (vector<pair<int, EventHandlerPtr> >::iterator p = _adds.begin(); p != _adds.end(); ++p) { _handlers.insert(*p); FD_SET(p->first, &_fdSet); _maxFd = max(_maxFd, p->first); + _minFd = min(_minFd, p->first); } _adds.clear(); again = true; @@ -296,9 +298,11 @@ IceInternal::ThreadPool::run() } _removes.clear(); _maxFd = _fdIntrRead; + _minFd = _fdIntrRead; if (!_handlers.empty()) { _maxFd = max(_maxFd, (--_handlers.end())->first); + _minFd = min(_minFd, (--_handlers.end())->first); } again = true; if (_handlers.empty() || _servers == 0) @@ -311,15 +315,19 @@ IceInternal::ThreadPool::run() { goto repeatSelect; } - + // // Round robin for the filedescriptors // + if (_lastFd < _minFd - 1) + { + _lastFd = _minFd - 1; + } do { if (++_lastFd > _maxFd) { - _lastFd = 0; + _lastFd = _minFd; } } while (!FD_ISSET(_lastFd, &fdSet)); |