class epicsThread is joinable

This commit is contained in:
Michael Davidsaver
2018-04-04 11:28:08 -07:00
parent d989c8fade
commit c9dcab95a6
2 changed files with 20 additions and 3 deletions
+19 -3
View File
@@ -153,6 +153,10 @@ bool epicsThread::exitWait ( const double delay ) throw ()
if ( this->pThreadDestroyed ) {
*this->pThreadDestroyed = true;
}
if(!joined) {
epicsThreadJoin(this->id);
joined = true;
}
return true;
}
epicsTime exitWaitBegin = epicsTime::getCurrent ();
@@ -166,6 +170,10 @@ bool epicsThread::exitWait ( const double delay ) throw ()
epicsTime current = epicsTime::getCurrent ();
exitWaitElapsed = current - exitWaitBegin;
}
if(!joined) {
epicsThreadJoin(this->id);
joined = true;
}
}
catch ( std :: exception & except ) {
errlogPrintf (
@@ -190,10 +198,18 @@ epicsThread::epicsThread (
unsigned stackSize, unsigned priority ) :
runable ( runableIn ), id ( 0 ), pThreadDestroyed ( 0 ),
begin ( false ), cancel ( false ), terminated ( false )
, joined(false)
{
this->id = epicsThreadCreate (
pName, priority, stackSize, epicsThreadCallEntryPoint,
static_cast < void * > ( this ) );
epicsThreadOpts opts;
epicsThreadOptsDefaults(&opts);
opts.stackSize = stackSize;
opts.priority = priority;
opts.joinable = 1;
this->id = epicsThreadCreateOpt(
pName, epicsThreadCallEntryPoint,
static_cast < void * > ( this ),
&opts);
if ( ! this->id ) {
throw unableToCreateThread ();
}
+1
View File
@@ -197,6 +197,7 @@ private:
bool begin;
bool cancel;
bool terminated;
bool joined;
bool beginWait () throw ();
epicsThread ( const epicsThread & );