epicsThreadMustJoin() clear joinable flag

Clear so that repeated calls will error correctly.
Only well defined for self join.
This commit is contained in:
Michael Davidsaver
2019-06-23 07:53:23 -07:00
parent 5efce9ecc0
commit 9e5c63fb91
3 changed files with 10 additions and 3 deletions
+3 -1
View File
@@ -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.
+4 -1
View File
@@ -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);
}
}
+3 -1
View File
@@ -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);
}