summaryrefslogtreecommitdiff
path: root/cpp/src/IceUtil/Thread.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2006-03-24 14:32:35 +0000
committerBenoit Foucher <benoit@zeroc.com>2006-03-24 14:32:35 +0000
commitc9a1e3aad627ee02dd5a17b374528f48c9ebe157 (patch)
tree912ba1a8707db30c1ce7fa6792691e90c824732a /cpp/src/IceUtil/Thread.cpp
parentFix (diff)
downloadice-c9a1e3aad627ee02dd5a17b374528f48c9ebe157.tar.bz2
ice-c9a1e3aad627ee02dd5a17b374528f48c9ebe157.tar.xz
ice-c9a1e3aad627ee02dd5a17b374528f48c9ebe157.zip
Fixed bug 916.
Diffstat (limited to 'cpp/src/IceUtil/Thread.cpp')
-rw-r--r--cpp/src/IceUtil/Thread.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/cpp/src/IceUtil/Thread.cpp b/cpp/src/IceUtil/Thread.cpp
index ecb41166ea3..5efb71f1aab 100644
--- a/cpp/src/IceUtil/Thread.cpp
+++ b/cpp/src/IceUtil/Thread.cpp
@@ -117,18 +117,21 @@ WINAPI startHook(void* arg)
{
IceUtil::Thread* rawThread = static_cast<IceUtil::Thread*>(arg);
- //
- // Initialize the random number generator in each thread.
- //
- unsigned int seed = static_cast<unsigned int>(IceUtil::Time::now().toMicroSeconds());
- srand(seed);
-
//
// Ensure that the thread doesn't go away until run() has
// completed.
//
thread = rawThread;
+#ifdef _WIN32
+ //
+ // Initialize the random number generator in each thread on
+ // Windows (the rand() seed is thread specific).
+ //
+ unsigned int seed = static_cast<unsigned int>(IceUtil::Time::now().toMicroSeconds());
+ srand(seed ^ thread->getThreadControl().id());
+#endif
+
//
// See the comment in IceUtil::Thread::start() for details.
//