epicsThread avoid possible data race on joined

This commit is contained in:
Michael Davidsaver
2019-07-08 10:34:53 -07:00
parent ee1eac3f4c
commit f134abb84e

View File

@@ -153,11 +153,13 @@ bool epicsThread::exitWait ( const double delay ) throw ()
if ( this->pThreadDestroyed ) {
*this->pThreadDestroyed = true;
}
if(!joined) {
{
epicsGuard < epicsMutex > guard ( this->mutex );
joined = true;
}
bool j;
{
epicsGuard < epicsMutex > guard ( this->mutex );
j = joined;
joined = true;
}
if(!j) {
epicsThreadMustJoin(this->id);
}
return true;