Added srand call to thread startup as each thread needs to be seeded in Windows.
This commit is contained in:
parent
d993fdef90
commit
1fcc9f68fd
1 changed files with 6 additions and 0 deletions
|
@ -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();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue