summaryrefslogtreecommitdiff
path: root/cpp/src/IceUtil/Thread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/IceUtil/Thread.cpp')
-rw-r--r--cpp/src/IceUtil/Thread.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/cpp/src/IceUtil/Thread.cpp b/cpp/src/IceUtil/Thread.cpp
index bb99ee54841..ba9506965e5 100644
--- a/cpp/src/IceUtil/Thread.cpp
+++ b/cpp/src/IceUtil/Thread.cpp
@@ -189,6 +189,12 @@ 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.