more RTEMS join
This commit is contained in:
@@ -366,7 +366,7 @@ threadMustCreate (const char *name,
|
||||
void epicsThreadMustJoin(epicsThreadId id)
|
||||
{
|
||||
rtems_id target_tid = (rtems_id)id, self_tid;
|
||||
struct taskVar *v;
|
||||
struct taskVar *v = 0;
|
||||
|
||||
rtems_task_ident (RTEMS_SELF, 0, &self_tid);
|
||||
|
||||
@@ -375,10 +375,11 @@ void epicsThreadMustJoin(epicsThreadId id)
|
||||
rtems_task_get_note (target_tid, RTEMS_NOTEPAD_TASKVAR, ¬e);
|
||||
v = (void *)note;
|
||||
}
|
||||
/* 'v' may be NULL if 'id' represents a non-EPICS thread other than _main_. */
|
||||
|
||||
if(!v->joinable) {
|
||||
if(!v || !v->joinable) {
|
||||
if(epicsThreadGetIdSelf()==id) {
|
||||
errlogPrintf("Warning: %s thread self-join of unjoinable\n", v->name);
|
||||
errlogPrintf("Warning: %s thread self-join of unjoinable\n", v ? v->name : "non-EPICS thread");
|
||||
|
||||
} else {
|
||||
/* try to error nicely, however in all likelyhood de-ref of
|
||||
|
||||
@@ -172,10 +172,17 @@ MAIN(epicsThreadTest)
|
||||
unsigned int ncpus = epicsThreadGetCPUs();
|
||||
testDiag("System has %u CPUs", ncpus);
|
||||
testOk1(ncpus > 0);
|
||||
testDiag("main() thread %p", epicsThreadGetIdSelf());
|
||||
|
||||
testMyThread();
|
||||
testSelfJoin();
|
||||
testOkToBlock();
|
||||
|
||||
// attempt to self-join from a non-EPICS thread
|
||||
// to make sure it does nothing as expected
|
||||
eltc(0);
|
||||
epicsThreadMustJoin(epicsThreadGetIdSelf());
|
||||
eltc(1);
|
||||
|
||||
return testDone();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user