summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2004-04-22 17:54:27 +0000
committerBernard Normier <bernard@zeroc.com>2004-04-22 17:54:27 +0000
commitca990558373e6e1f54dd36b7457b1dd25b5eb332 (patch)
treec8122b48f99eb3571b45aeeae1cdfb8dfd450fe7 /cpp/src
parentfix (diff)
downloadice-ca990558373e6e1f54dd36b7457b1dd25b5eb332.tar.bz2
ice-ca990558373e6e1f54dd36b7457b1dd25b5eb332.tar.xz
ice-ca990558373e6e1f54dd36b7457b1dd25b5eb332.zip
Fixed thread start race condition
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/IceUtil/Thread.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/cpp/src/IceUtil/Thread.cpp b/cpp/src/IceUtil/Thread.cpp
index de1d907a4bc..c9704378849 100644
--- a/cpp/src/IceUtil/Thread.cpp
+++ b/cpp/src/IceUtil/Thread.cpp
@@ -220,6 +220,11 @@ startHook(void* arg)
IceUtil::ThreadControl
IceUtil::Thread::start()
{
+ //
+ // Keep this alive for the duration of start
+ //
+ IceUtil::ThreadPtr keepMe = this;
+
IceUtil::Mutex::Lock lock(_stateMutex);
if(_started)
@@ -501,6 +506,11 @@ startHook(void* arg)
IceUtil::ThreadControl
IceUtil::Thread::start()
{
+ //
+ // Keep this alive for the duration of start
+ //
+ IceUtil::ThreadPtr keepMe = this;
+
IceUtil::Mutex::Lock lock(_stateMutex);
if(_started)