summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2003-03-13 19:53:21 +0000
committerMarc Laukien <marc@zeroc.com>2003-03-13 19:53:21 +0000
commitd774349054e09a717a92f95391dd663f1ba8b29b (patch)
treed2784c92c78aef72806add1b9c87ab5e1259f32d /cpp/src
parentstarted with shrinking pool (diff)
downloadice-d774349054e09a717a92f95391dd663f1ba8b29b.tar.bz2
ice-d774349054e09a717a92f95391dd663f1ba8b29b.tar.xz
ice-d774349054e09a717a92f95391dd663f1ba8b29b.zip
started with shrinking pool; inlined ops in IceUtil::Time
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/.depend4
-rw-r--r--cpp/src/Ice/ObjectAdapterI.cpp5
-rw-r--r--cpp/src/Ice/ThreadPool.cpp27
-rw-r--r--cpp/src/Ice/ThreadPool.h16
-rw-r--r--cpp/src/IceUtil/Time.cpp70
5 files changed, 27 insertions, 95 deletions
diff --git a/cpp/src/Ice/.depend b/cpp/src/Ice/.depend
index 7bf4cdcc7d2..b23765b5e27 100644
--- a/cpp/src/Ice/.depend
+++ b/cpp/src/Ice/.depend
@@ -6,7 +6,7 @@ Properties.o: Properties.cpp ../../include/Ice/Properties.h ../../include/Ice/Lo
PropertiesI.o: PropertiesI.cpp ../Ice/PropertiesI.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Config.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/IceUtil/Exception.h ../../include/Ice/Properties.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Facet.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/LocalException.h
Logger.o: Logger.cpp ../../include/Ice/Logger.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h
LoggerUtil.o: LoggerUtil.cpp ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/Logger.h
-LoggerI.o: LoggerI.cpp ../Ice/LoggerI.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Config.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/IceUtil/Exception.h ../../include/Ice/Logger.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h
+LoggerI.o: LoggerI.cpp ../../include/IceUtil/Time.h ../../include/IceUtil/Config.h ../Ice/LoggerI.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/IceUtil/Exception.h ../../include/Ice/Logger.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h
Stats.o: Stats.cpp ../../include/Ice/Stats.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h
SysLoggerI.o: SysLoggerI.cpp ../Ice/SysLoggerI.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Config.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/IceUtil/Exception.h ../../include/Ice/Logger.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h
Stream.o: Stream.cpp ../../include/Ice/Stream.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Facet.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/LocalException.h ../../include/Ice/ObjectFactory.h
@@ -55,7 +55,7 @@ Incoming.o: Incoming.cpp ../../include/Ice/Incoming.h ../../include/Ice/Instance
IncomingAsync.o: IncomingAsync.cpp ../../include/Ice/IncomingAsync.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/Incoming.h ../../include/Ice/InstanceF.h ../../include/Ice/ConnectionF.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Current.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/Identity.h ../../include/Ice/Facet.h ../../include/Ice/ServantLocator.h ../../include/Ice/Object.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../Ice/Connection.h ../../include/IceUtil/RecMutex.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/ConnectionFactoryF.h ../Ice/TransceiverF.h ../../include/Ice/EndpointF.h ../../include/Ice/LoggerF.h ../Ice/TraceLevelsF.h ../../include/Ice/OutgoingAsyncF.h ../Ice/EventHandler.h ../Ice/EventHandlerF.h ../Ice/ThreadPoolF.h ../../include/Ice/LocalException.h ../Ice/Protocol.h
Direct.o: Direct.cpp ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/Identity.h ../../include/Ice/Facet.h ../Ice/ObjectAdapterI.h ../../include/IceUtil/RecMutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/Outgoing.h ../../include/Ice/BasicStream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/ServantManagerF.h ../../include/Ice/CommunicatorF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/ObjectAdapterFactoryF.h ../../include/Ice/ConnectionFactoryF.h ../Ice/LocatorInfoF.h ../Ice/ThreadPoolF.h ../Ice/ServantManager.h ../../include/Ice/ServantLocator.h ../Ice/Reference.h ../Ice/ReferenceFactoryF.h ../Ice/RouterInfoF.h ../../include/Ice/LocalException.h
Network.o: Network.cpp ../../include/IceUtil/Mutex.h ../../include/IceUtil/Config.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/IceUtil/Exception.h ../Ice/Network.h ../../include/Ice/Config.h ../../include/Ice/LocalException.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/Identity.h ../../include/Ice/Facet.h
-ThreadPool.o: ThreadPool.cpp ../Ice/ThreadPool.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Config.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Thread.h ../../include/IceUtil/Handle.h ../Ice/ThreadPoolF.h ../../include/Ice/Handle.h ../../include/Ice/Config.h ../../include/Ice/InstanceF.h ../../include/Ice/LoggerF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../Ice/EventHandlerF.h ../Ice/EventHandler.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../Ice/Network.h ../../include/Ice/LocalException.h ../../include/Ice/Identity.h ../../include/Ice/Facet.h ../Ice/Instance.h ../../include/IceUtil/RecMutex.h ../../include/Ice/CommunicatorF.h ../../include/Ice/StatsF.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionFactoryF.h ../../include/Ice/ConnectionMonitorF.h ../Ice/ObjectFactoryManagerF.h ../Ice/UserExceptionFactoryManagerF.h ../../include/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../../include/Ice/DynamicLibraryF.h ../../include/Ice/PluginF.h ../../include/Ice/LoggerUtil.h ../../include/Ice/Functional.h ../../include/IceUtil/Functional.h ../Ice/Protocol.h ../Ice/ObjectAdapterFactory.h ../Ice/ObjectAdapterI.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/Proxy.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/Outgoing.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h
+ThreadPool.o: ThreadPool.cpp ../Ice/ThreadPool.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Config.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Thread.h ../../include/IceUtil/Handle.h ../Ice/ThreadPoolF.h ../../include/Ice/Handle.h ../../include/Ice/Config.h ../../include/Ice/InstanceF.h ../../include/Ice/LoggerF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../Ice/EventHandlerF.h ../Ice/EventHandler.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../Ice/Network.h ../../include/Ice/LocalException.h ../../include/Ice/Identity.h ../../include/Ice/Facet.h ../Ice/Instance.h ../../include/IceUtil/RecMutex.h ../../include/Ice/CommunicatorF.h ../../include/Ice/StatsF.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionFactoryF.h ../../include/Ice/ConnectionMonitorF.h ../Ice/ObjectFactoryManagerF.h ../Ice/UserExceptionFactoryManagerF.h ../../include/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../../include/Ice/DynamicLibraryF.h ../../include/Ice/PluginF.h ../../include/Ice/LoggerUtil.h ../../include/Ice/Functional.h ../../include/IceUtil/Functional.h ../Ice/Protocol.h ../Ice/ObjectAdapterFactory.h ../Ice/ObjectAdapterI.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/Proxy.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/OutgoingAsyncF.h ../../include/Ice/Current.h ../../include/Ice/Object.h ../../include/Ice/IncomingAsyncF.h ../../include/Ice/Outgoing.h ../../include/Ice/Incoming.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ServantManagerF.h ../../include/Ice/Direct.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/Properties.h ../../include/Ice/BuiltinSequences.h
EventHandler.o: EventHandler.cpp ../Ice/EventHandler.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Config.h ../Ice/EventHandlerF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/Ice/Config.h ../../include/Ice/InstanceF.h ../Ice/ThreadPoolF.h ../../include/Ice/BasicStream.h ../../include/Ice/ObjectF.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/Ice/StreamF.h ../Ice/Instance.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/IceUtil/ThreadException.h ../../include/IceUtil/RecMutex.h ../../include/Ice/CommunicatorF.h ../../include/Ice/PropertiesF.h ../../include/Ice/LoggerF.h ../../include/Ice/StatsF.h ../Ice/TraceLevelsF.h ../Ice/DefaultsAndOverridesF.h ../Ice/RouterInfoF.h ../Ice/LocatorInfoF.h ../Ice/ReferenceFactoryF.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionFactoryF.h ../../include/Ice/ConnectionMonitorF.h ../Ice/ObjectFactoryManagerF.h ../Ice/UserExceptionFactoryManagerF.h ../../include/Ice/ObjectAdapterFactoryF.h ../Ice/EndpointFactoryManagerF.h ../../include/Ice/DynamicLibraryF.h ../../include/Ice/PluginF.h
Connector.o: Connector.cpp ../Ice/Connector.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Config.h ../Ice/ConnectorF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/Ice/Config.h ../Ice/TransceiverF.h
Acceptor.o: Acceptor.cpp ../Ice/Acceptor.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Config.h ../Ice/AcceptorF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/Ice/Config.h ../Ice/TransceiverF.h
diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp
index 4d8f559a058..f96d57b72af 100644
--- a/cpp/src/Ice/ObjectAdapterI.cpp
+++ b/cpp/src/Ice/ObjectAdapterI.cpp
@@ -609,8 +609,9 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const Communica
setLocator(_instance->referenceFactory()->getDefaultLocator());
}
- int threadNum = _instance->properties()->getPropertyAsInt(_name + ".ThreadPool.Size");
- if(threadNum > 0)
+ int size = _instance->properties()->getPropertyAsInt(_name + ".ThreadPool.Size");
+ int sizeMax = _instance->properties()->getPropertyAsInt(_name + ".ThreadPool.SizeMax");
+ if(size > 0 || sizeMax > 0)
{
_threadPool = new ThreadPool(_instance, _name + ".ThreadPool", 0);
}
diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp
index 895089feadd..a87570afa78 100644
--- a/cpp/src/Ice/ThreadPool.cpp
+++ b/cpp/src/Ice/ThreadPool.cpp
@@ -34,12 +34,13 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& p
_instance(instance),
_destroyed(false),
_prefix(prefix),
+ _lastFd(INVALID_SOCKET),
+ _timeout(timeout),
_size(0),
_sizeMax(0),
_sizeWarn(0),
_inUse(0),
- _lastFd(INVALID_SOCKET),
- _timeout(timeout)
+ _load(0)
{
SOCKET fds[2];
createPipe(fds);
@@ -56,9 +57,6 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& p
if(size < 1)
{
size = 1;
- ostringstream str;
- str << size;
- _instance->properties()->setProperty(_prefix + ".Size", str.str());
}
const_cast<int&>(_size) = size;
@@ -66,9 +64,6 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& p
if(sizeMax < _size)
{
sizeMax = _size;
- ostringstream str;
- str << sizeMax;
- _instance->properties()->setProperty(_prefix + ".SizeMax", str.str());
}
const_cast<int&>(_sizeMax) = sizeMax;
@@ -147,12 +142,15 @@ IceInternal::ThreadPool::promoteFollower()
{
if(_sizeMax > 1)
{
- _threadMutex.unlock();
+ _promoteMutex.unlock();
{
- IceUtil::Mutex::Lock sync(_inUseMutex);
+ IceUtil::Mutex::Lock sync(*this);
+
assert(_inUse >= 0);
++_inUse;
+// _load = std::max(_load * 0.95 + _inUse * 0.05, static_cast<double>(_inUse)); // TODO: Configurable?
+// cout << "_load = " << _load << endl;
if(_inUse == _sizeWarn)
{
@@ -280,7 +278,7 @@ IceInternal::ThreadPool::run()
if(_sizeMax > 1)
{
- _threadMutex.lock();
+ _promoteMutex.lock();
}
while(true)
@@ -551,12 +549,13 @@ IceInternal::ThreadPool::run()
if(_sizeMax > 1)
{
{
- IceUtil::Mutex::Lock sync(_inUseMutex);
+ IceUtil::Mutex::Lock sync(*this);
+
assert(_inUse > 0);
--_inUse;
}
- _threadMutex.lock();
+ _promoteMutex.lock();
}
}
}
@@ -671,7 +670,7 @@ IceInternal::ThreadPool::EventHandlerThread::run()
//
if(_pool->_sizeMax > 1)
{
- _pool->_threadMutex.unlock();
+ _pool->_promoteMutex.unlock();
}
_pool = 0; // Break cyclic dependency.
diff --git a/cpp/src/Ice/ThreadPool.h b/cpp/src/Ice/ThreadPool.h
index 26df7f14ee5..d4fdea8b10e 100644
--- a/cpp/src/Ice/ThreadPool.h
+++ b/cpp/src/Ice/ThreadPool.h
@@ -17,6 +17,7 @@
#include <IceUtil/Shared.h>
#include <IceUtil/Mutex.h>
+#include <IceUtil/Monitor.h>
#include <IceUtil/Thread.h>
#include <Ice/ThreadPoolF.h>
@@ -62,12 +63,6 @@ private:
bool _destroyed;
const std::string _prefix;
- const int _size; // Number of threads that are pre-created.
- const int _sizeMax; // Maximum number of threads.
- const int _sizeWarn; // If _inUse reaches _sizeWarn, a "low on threads" warning will be printed.
- int _inUse; // Number of threads that are currently in use.
- IceUtil::Mutex _inUseMutex;
-
SOCKET _maxFd;
SOCKET _minFd;
SOCKET _lastFd;
@@ -81,8 +76,6 @@ private:
int _timeout;
- IceUtil::Mutex _threadMutex;
-
class EventHandlerThread : public IceUtil::Thread
{
public:
@@ -97,6 +90,13 @@ private:
friend class EventHandlerThread;
std::vector<IceUtil::ThreadControl> _threads; // Control for all threads, running or not.
+ const int _size; // Number of threads that are pre-created.
+ const int _sizeMax; // Maximum number of threads.
+ const int _sizeWarn; // If _inUse reaches _sizeWarn, a "low on threads" warning will be printed.
+ int _inUse; // Number of threads that are currently in use.
+ double _load; // Current load in number of threads.
+
+ IceUtil::Mutex _promoteMutex;
};
}
diff --git a/cpp/src/IceUtil/Time.cpp b/cpp/src/IceUtil/Time.cpp
index ee3cecd88cc..8283358eb25 100644
--- a/cpp/src/IceUtil/Time.cpp
+++ b/cpp/src/IceUtil/Time.cpp
@@ -60,74 +60,6 @@ IceUtil::Time::microSeconds(Int64 t)
return Time(t);
}
-Time
-IceUtil::Time::operator-() const
-{
- return Time(-_usec);
-}
-
-Time
-IceUtil::Time::operator-(const Time& rhs) const
-{
- return Time(_usec - rhs._usec);
-}
-
-Time
-IceUtil::Time::operator+(const Time& rhs) const
-{
- return Time(_usec + rhs._usec);
-}
-
-Time&
-IceUtil::Time::operator+=(const Time& rhs)
-{
- _usec += rhs._usec;
- return *this;
-}
-
-Time&
-IceUtil::Time::operator-=(const Time& rhs)
-{
- _usec -= rhs._usec;
- return *this;
-}
-
-bool
-IceUtil::Time::operator<(const Time& rhs) const
-{
- return _usec < rhs._usec;
-}
-
-bool
-IceUtil::Time::operator<=(const Time& rhs) const
-{
- return _usec <= rhs._usec;
-}
-
-bool
-IceUtil::Time::operator>(const Time& rhs) const
-{
- return _usec > rhs._usec;
-}
-
-bool
-IceUtil::Time::operator>=(const Time& rhs) const
-{
- return _usec >= rhs._usec;
-}
-
-bool
-IceUtil::Time::operator==(const Time& rhs) const
-{
- return _usec == rhs._usec;
-}
-
-bool
-IceUtil::Time::operator!=(const Time& rhs) const
-{
- return _usec != rhs._usec;
-}
-
IceUtil::Time::operator timeval() const
{
timeval tv;
@@ -156,7 +88,7 @@ IceUtil::Time::toString() const
#endif
char buf[32];
- strftime(buf, sizeof(buf), "%x %H:%M:%S", t);
+ strftime(buf, sizeof(buf), "%Y %H:%M:%S", t);
std::ostringstream os;
os << buf << ":";