X-Git-Url: http://code.vuplus.com/gitweb/?a=blobdiff_plain;f=lib%2Fbase%2Fthread.h;h=8ee96594aa6c940e4ee30180ba598039bc188cd2;hb=417e393cbc7b4fd22482aa21cdeeb3e8dec3128c;hp=dad80424b526571efc72ecace1848fdc769457a8;hpb=e51726bcb1904bf8422b62798bd9f0cd2efb53ad;p=vuplus_dvbapp diff --git a/lib/base/thread.h b/lib/base/thread.h index dad8042..8ee9659 100644 --- a/lib/base/thread.h +++ b/lib/base/thread.h @@ -29,6 +29,11 @@ public: eThread(); virtual ~eThread(); + /* thread_finished is called from within the thread context as the last function + before the thread is going to die. + It should be used to do final cleanups (unlock locked mutexes ....) */ + virtual void thread_finished() {} + /* runAsync starts the thread. it assumes that the thread is not running, i.e. sync() *must* return 0. @@ -46,7 +51,7 @@ public: /* result: 0 - thread is not alive 1 - thread state unknown */ int sync(); - void sendSignal(int sig); + int sendSignal(int sig); /* join the thread, i.e. busywait until thread has finnished. */ void kill(bool sendcancel=false); @@ -54,7 +59,7 @@ private: pthread_t the_thread; static void *wrapper(void *ptr); - int m_alive; + int m_alive, m_started; static void thread_completed(void *p); eSemaphore m_state;