diff --git a/src/ca/processThread.cpp b/src/ca/processThread.cpp index 33d28b23a..3be2f08b2 100644 --- a/src/ca/processThread.cpp +++ b/src/ca/processThread.cpp @@ -18,10 +18,11 @@ #include processThread::processThread (cac *pcacIn) : - osiThread ("CAC process", 0x1000, threadPriorityMedium), + osiThread (), pcac (pcacIn), shutDown (false) { + start("CAC process", 0x1000, threadPriorityMedium); } processThread::~processThread () diff --git a/src/libCom/osi/osiThread.cpp b/src/libCom/osi/osiThread.cpp index 40f326af0..92205479d 100644 --- a/src/libCom/osi/osiThread.cpp +++ b/src/libCom/osi/osiThread.cpp @@ -19,16 +19,22 @@ static void osiThreadCallEntryPoint (void *pPvt) pThread->exit.signal (); } -osiThread::osiThread (const char *name, unsigned stackSize, - unsigned priority) + +osiThread::osiThread () : id(0), exit() { - this->id = threadCreate (name, priority, stackSize, - osiThreadCallEntryPoint, static_cast (this) ); } osiThread::~osiThread () { while ( !this->exit.wait (5.0) ) { - printf ("osiThread::~osiThread (): Warning, thread object destroyed before thread exit \n"); + printf ("osiThread::~osiThread ():" + " Warning, thread object destroyed before thread exit \n"); } } + +void osiThread::start(const char *name, unsigned stackSize, unsigned priority) +{ + id = threadCreate (name, priority, stackSize, + osiThreadCallEntryPoint, static_cast (this) ); +} + diff --git a/src/libCom/osi/osiThread.h b/src/libCom/osi/osiThread.h index 615cbb177..fc248aea1 100644 --- a/src/libCom/osi/osiThread.h +++ b/src/libCom/osi/osiThread.h @@ -99,10 +99,12 @@ epicsShareFunc void * epicsShareAPI threadPrivateGet (threadPrivateId); class epicsShareClass osiThread { public: - osiThread (const char *name, unsigned stackSize, - unsigned priority=threadPriorityLow); + osiThread(); virtual ~osiThread (); + void start(const char *name, unsigned stackSize, + unsigned priority=threadPriorityLow); + virtual void entryPoint () = 0; void resume (); diff --git a/src/libCom/timer/osiTimer.cpp b/src/libCom/timer/osiTimer.cpp index 739483448..32cb27b18 100644 --- a/src/libCom/timer/osiTimer.cpp +++ b/src/libCom/timer/osiTimer.cpp @@ -438,9 +438,9 @@ osiTimerQueue::~osiTimerQueue() // osiTimerThread::osiTimerThread () // osiTimerThread::osiTimerThread (osiTimerQueue &queueIn, unsigned priority) : - osiThread ("osiTimerQueue", threadGetStackSize (threadStackMedium), priority), - queue (queueIn) + osiThread (), queue (queueIn) { + start("osiTimerQueue", threadGetStackSize (threadStackMedium), priority); } //