libCom/WIN32: Merged Jeff's fix for bug 717252
o Fixed race condition where win32 thread parm was not pushed onto the list before the thread was started, and so if the thread exits very quickly it can try to remove a non-existent thread parameter from the list. o This impacts only win32.
This commit is contained in:
committed by
Andrew Johnson
parent
c698853394
commit
fd72cb63bf
@@ -630,18 +630,21 @@ epicsShareFunc epicsThreadId epicsShareAPI epicsThreadCreate (const char *pName,
|
||||
free ( pParmWIN32 );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EnterCriticalSection ( & pGbl->mutex );
|
||||
ellAdd ( & pGbl->threadList, & pParmWIN32->node );
|
||||
LeaveCriticalSection ( & pGbl->mutex );
|
||||
|
||||
wstat = ResumeThread ( pParmWIN32->handle );
|
||||
if (wstat==0xFFFFFFFF) {
|
||||
EnterCriticalSection ( & pGbl->mutex );
|
||||
ellDelete ( & pGbl->threadList, & pParmWIN32->node );
|
||||
LeaveCriticalSection ( & pGbl->mutex );
|
||||
CloseHandle ( pParmWIN32->handle );
|
||||
free ( pParmWIN32 );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EnterCriticalSection ( & pGbl->mutex );
|
||||
ellAdd ( & pGbl->threadList, & pParmWIN32->node );
|
||||
LeaveCriticalSection ( & pGbl->mutex );
|
||||
|
||||
return ( epicsThreadId ) pParmWIN32;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user