summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2001-09-18 07:14:51 +0000
committerMarc Laukien <marc@zeroc.com>2001-09-18 07:14:51 +0000
commit48fb0e4fbb09a1c6558ac177f80ed68c86eb9329 (patch)
tree041cf8166693141147c42a3cea32002f39a747d7 /cpp/src
parentthread-safe shutdown (diff)
downloadice-48fb0e4fbb09a1c6558ac177f80ed68c86eb9329.tar.bz2
ice-48fb0e4fbb09a1c6558ac177f80ed68c86eb9329.tar.xz
ice-48fb0e4fbb09a1c6558ac177f80ed68c86eb9329.zip
shutdown fixes
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/CommunicatorI.cpp7
-rw-r--r--cpp/src/Ice/Instance.cpp3
-rw-r--r--cpp/src/Ice/ThreadPool.cpp20
3 files changed, 5 insertions, 25 deletions
diff --git a/cpp/src/Ice/CommunicatorI.cpp b/cpp/src/Ice/CommunicatorI.cpp
index 85db7a08a7a..eea0778af89 100644
--- a/cpp/src/Ice/CommunicatorI.cpp
+++ b/cpp/src/Ice/CommunicatorI.cpp
@@ -28,18 +28,11 @@ Ice::CommunicatorI::destroy()
{
JTCSyncT<JTCRecursiveMutex> sync(*this);
- shutdown();
-
if (_instance)
{
_instance->destroy();
_instance = 0;
}
-
- //
- // Don't set _threadPool to null here! See the comments in the
- // header file.
- //
}
void
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index 5be7f7c3dca..f63938cae95 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -382,8 +382,7 @@ IceInternal::Instance::destroy()
if(_objectAdapterFactory)
{
- // No destroy function defined
- // _objectAdapterFactory->destroy();
+ _objectAdapterFactory->shutdown(); // ObjectAdapterFactory has shutdown(), not destroy()
_objectAdapterFactory = 0;
}
diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp
index e00cc92c324..30b2f3ef6ec 100644
--- a/cpp/src/Ice/ThreadPool.cpp
+++ b/cpp/src/Ice/ThreadPool.cpp
@@ -171,6 +171,7 @@ void
IceInternal::ThreadPool::destroy()
{
JTCSyncT<JTCMonitorT<JTCMutex> > sync(*this);
+ assert(_instance);
_instance = 0;
setInterrupt();
}
@@ -209,17 +210,16 @@ IceInternal::ThreadPool::setInterrupt()
void
IceInternal::ThreadPool::run()
{
- bool shutdown = false;
-
while (true)
{
_threadMutex.lock();
+ bool shutdown = false;
EventHandlerPtr handler;
InstancePtr instance;
repeatSelect:
-
+
if (shutdown) // Shutdown has been initiated
{
shutdown = false;
@@ -276,20 +276,10 @@ IceInternal::ThreadPool::run()
}
bool again = false;
-
if (FD_ISSET(_fdIntrRead, &fdSet))
{
+ again = true;
shutdown = clearInterrupt();
- if (shutdown)
- {
- again = true;
- }
-
-#ifdef WIN32
- FD_CLR(static_cast<u_int>(_fdIntrRead), &fdSet);
-#else
- FD_CLR(_fdIntrRead, &fdSet);
-#endif
}
if (!_adds.empty())
@@ -305,7 +295,6 @@ IceInternal::ThreadPool::run()
_minFd = min(_minFd, p->first);
}
_adds.clear();
- again = true;
}
if (!_removes.empty())
@@ -337,7 +326,6 @@ IceInternal::ThreadPool::run()
_maxFd = max(_maxFd, (--_handlers.end())->first);
_minFd = min(_minFd, (--_handlers.end())->first);
}
- again = true;
if (_handlers.empty() || _servers == 0)
{
notifyAll(); // For waitUntil...Finished() methods