From d02b8a526d9dff817b425a394344c4061115a2f4 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Mon, 13 Mar 2000 15:35:11 +0000 Subject: [PATCH] fixed gnu warnings --- src/libCom/osi/osiThread.cpp | 10 ++++++++++ src/libCom/osi/osiThread.h | 9 ++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/libCom/osi/osiThread.cpp b/src/libCom/osi/osiThread.cpp index a9a8b8637..5f4d0b6c3 100644 --- a/src/libCom/osi/osiThread.cpp +++ b/src/libCom/osi/osiThread.cpp @@ -4,7 +4,9 @@ // Author: Jeff Hill // +#include #include + #define epicsExportSharedSymbols #include "osiThread.h" @@ -12,6 +14,7 @@ static void osiThreadCallEntryPoint (void *pPvt) { osiThread *pThread = static_cast (pPvt); pThread->entryPoint (); + pThread->exit.signal (); } osiThread::osiThread (const char *name, unsigned stackSize, @@ -20,3 +23,10 @@ osiThread::osiThread (const char *name, unsigned stackSize, 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"); + } +} diff --git a/src/libCom/osi/osiThread.h b/src/libCom/osi/osiThread.h index 74c7206da..9823ae1b7 100644 --- a/src/libCom/osi/osiThread.h +++ b/src/libCom/osi/osiThread.h @@ -88,11 +88,15 @@ epicsShareFunc void * epicsShareAPI threadPrivateGet (threadPrivateId); #ifdef __cplusplus #include "locationException.h" +#include "osiEvent.h" -class osiThread { +static void osiThreadCallEntryPoint (void *pPvt); // for gnu warning + +class epicsShareClass osiThread { public: osiThread (const char *name, unsigned stackSize, unsigned priority=threadPriorityLow); + virtual ~osiThread (); virtual void entryPoint () = 0; @@ -112,6 +116,9 @@ public: static const char * getNameSelf (); private: threadId id; + osiEvent exit; + + friend void osiThreadCallEntryPoint (void *pPvt); }; template