Added srand call to thread startup as each thread needs to be seeded in Windows.

This commit is contained in:
Ron Koenderink 2004-08-14 19:35:38 +00:00
parent d993fdef90
commit 1fcc9f68fd

View file

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