diff options
author | Bernard Normier <bernard@zeroc.com> | 2004-04-22 17:54:27 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2004-04-22 17:54:27 +0000 |
commit | ca990558373e6e1f54dd36b7457b1dd25b5eb332 (patch) | |
tree | c8122b48f99eb3571b45aeeae1cdfb8dfd450fe7 /cpp/src | |
parent | fix (diff) | |
download | ice-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.cpp | 10 |
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) |