]> git.pond.sub.org Git - empserver/commitdiff
Added srand call to thread startup as each thread needs to be seeded in Windows.
authorRon Koenderink <rkoenderink@yahoo.ca>
Sat, 14 Aug 2004 19:35:38 +0000 (19:35 +0000)
committerRon Koenderink <rkoenderink@yahoo.ca>
Sat, 14 Aug 2004 19:35:38 +0000 (19:35 +0000)
src/lib/empthread/ntthread.c

index 54bb324f24ec244cf2dfbfa94ccd8796397ad326..f6435206d1b475c4203a5d9db2c8c23cf52a9a5f 100644 (file)
@@ -289,6 +289,8 @@ loc_SleepThisThread(unsigned long ulMillisecs)
 void
 empth_threadMain(void *pvData)
 {
+    time_t now;
+
     loc_Thread_t *pThread = (loc_Thread_t *)pvData;
 
     /* Out of here... */
@@ -304,6 +306,10 @@ empth_threadMain(void *pvData)
     /* Signal that the thread has started. */
     SetEvent(loc_GVAR.hThreadStartEvent);
 
+    /* seed the rand() function */
+    time(&now);
+    srand(now ^ (unsigned int)pThread);
+
     /* Switch to this thread context */
     loc_RunThisThread();