epicsThreadMustJoin() clear joinable flag
Clear so that repeated calls will error correctly. Only well defined for self join.
This commit is contained in:
@@ -380,7 +380,8 @@ void epicsThreadMustJoin(epicsThreadId id)
|
||||
/* try to error nicely, however in all likelyhood rtems_task_get_note failed,
|
||||
* or gave us the wrong thread as we are racing thread exit.
|
||||
*/
|
||||
cantProceed("%s join not enabled for thread.\n", v->name);
|
||||
cantProceed("%s thread not joinable.\n", v->name);
|
||||
return;
|
||||
|
||||
} else if(target_tid!=self_tid) {
|
||||
/* wait for target to complete */
|
||||
@@ -393,6 +394,7 @@ void epicsThreadMustJoin(epicsThreadId id)
|
||||
}
|
||||
}
|
||||
|
||||
v->joinable = 0;
|
||||
taskUnref(v);
|
||||
/* target task may be deleted.
|
||||
* self task is not deleted, even for self join.
|
||||
|
||||
@@ -673,7 +673,8 @@ void epicsThreadMustJoin(epicsThreadId id)
|
||||
* 'pParmWIN32' has already crashed us as we are racing thread exit,
|
||||
* which free's 'pParmWIN32'.
|
||||
*/
|
||||
cantProceed("%s join not enabled for thread.\n", pParmWIN32->pName);
|
||||
cantProceed("%s thread not joinable.\n", pParmWIN32->pName);
|
||||
return;
|
||||
|
||||
} else if(epicsThreadGetIdSelf() != id) {
|
||||
DWORD status = WaitForSingleObject(pParmWIN32->handle, INFINITE);
|
||||
@@ -681,9 +682,11 @@ void epicsThreadMustJoin(epicsThreadId id)
|
||||
/* TODO: signal error? */
|
||||
}
|
||||
|
||||
pParmWIN32->joinable = 0;
|
||||
epicsParmCleanupWIN32(pParmWIN32);
|
||||
} else {
|
||||
/* join self silently does nothing */
|
||||
pParmWIN32->joinable = 0;
|
||||
epicsParmCleanupWIN32(pParmWIN32);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -612,7 +612,8 @@ void epicsThreadMustJoin(epicsThreadId id)
|
||||
* 'id' has already caused SIGSEGV as we are racing thread exit,
|
||||
* which free's 'id'.
|
||||
*/
|
||||
cantProceed("%s join not enabled for thread.\n", id->name);
|
||||
cantProceed("%s thread not joinable.\n", id->name);
|
||||
return;
|
||||
}
|
||||
|
||||
status = pthread_join(id->tid, &ret);
|
||||
@@ -623,6 +624,7 @@ void epicsThreadMustJoin(epicsThreadId id)
|
||||
status = pthread_detach(id->tid);
|
||||
checkStatusOnce(status, "pthread_detach");
|
||||
} else checkStatusOnce(status, "pthread_join");
|
||||
id->joinable = 0;
|
||||
free_threadInfo(id);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user