epicsThreadMustJoin() warn only on double self-join

This commit is contained in:
Michael Davidsaver
2019-06-23 08:56:32 -07:00
parent 86a942872a
commit 32b3eddb94
4 changed files with 108 additions and 42 deletions
+10 -4
View File
@@ -377,10 +377,16 @@ void epicsThreadMustJoin(epicsThreadId id)
}
if(!v->joinable) {
/* 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 thread not joinable.\n", v->name);
if(epicsThreadGetIdSelf()==id) {
errlogPrintf("Warning: %s thread self-join of unjoinable\n", v->name);
} else {
/* try to error nicely, however in all likelyhood de-ref of
* 'id' has already caused SIGSEGV as we are racing thread exit,
* which free's 'id'.
*/
cantProceed("Error: %s thread not joinable.\n", v->name);
}
return;
} else if(target_tid!=self_tid) {
+10 -5
View File
@@ -669,11 +669,16 @@ void epicsThreadMustJoin(epicsThreadId id)
if(!id) {
/* no-op */
} else if(!pParmWIN32->joinable) {
/* try to error nicely, however in all likelyhood de-ref of
* 'pParmWIN32' has already crashed us as we are racing thread exit,
* which free's 'pParmWIN32'.
*/
cantProceed("%s thread not joinable.\n", pParmWIN32->pName);
if(epicsThreadGetIdSelf()==id) {
fprintf(stderr, "Warning: %s thread self-join of unjoinable\n", pParmWIN32->pName);
} else {
/* try to error nicely, however in all likelyhood de-ref of
* 'id' has already caused SIGSEGV as we are racing thread exit,
* which free's 'id'.
*/
cantProceed("Error: %s thread not joinable.\n", pParmWIN32->pName);
}
return;
} else if(epicsThreadGetIdSelf() != id) {
+10 -5
View File
@@ -608,11 +608,16 @@ void epicsThreadMustJoin(epicsThreadId id)
if(!id) {
return;
} else if(!id->joinable) {
/* try to error nicely, however in all likelyhood de-ref of
* 'id' has already caused SIGSEGV as we are racing thread exit,
* which free's 'id'.
*/
cantProceed("%s thread not joinable.\n", id->name);
if(epicsThreadGetIdSelf()==id) {
errlogPrintf("Warning: %s thread self-join of unjoinable\n", id->name);
} else {
/* try to error nicely, however in all likelyhood de-ref of
* 'id' has already caused SIGSEGV as we are racing thread exit,
* which free's 'id'.
*/
cantProceed("Error: %s thread not joinable.\n", id->name);
}
return;
}