From 1fcc9f68fd0e01f58ac797f633e706fc955185b4 Mon Sep 17 00:00:00 2001 From: Ron Koenderink Date: Sat, 14 Aug 2004 19:35:38 +0000 Subject: [PATCH] Added srand call to thread startup as each thread needs to be seeded in Windows. --- src/lib/empthread/ntthread.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/empthread/ntthread.c b/src/lib/empthread/ntthread.c index 54bb324f2..f6435206d 100644 --- a/src/lib/empthread/ntthread.c +++ b/src/lib/empthread/ntthread.c @@ -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(); -- 2.43.0