X-Git-Url: http://code.vuplus.com/gitweb/?a=blobdiff_plain;f=lib%2Fbase%2Fthread.cpp;h=db6deb3585023c8a5fd0b6900af1177d19d326ad;hb=e8f443313e47e0653d61d23c90352572194e5608;hp=5353707dc9564f57f5a34476c6e8b558db360bcb;hpb=e40ddfb473102ade34ee1d0667d143ee204a2562;p=vuplus_dvbapp diff --git a/lib/base/thread.cpp b/lib/base/thread.cpp index 5353707..db6deb3 100644 --- a/lib/base/thread.cpp +++ b/lib/base/thread.cpp @@ -2,7 +2,6 @@ #include #include -#include #include void eThread::thread_completed(void *ptr) @@ -14,7 +13,7 @@ void eThread::thread_completed(void *ptr) if (!p->m_state.value()) { p->m_state.up(); - assert(p->m_state.value() == 1); + ASSERT(p->m_state.value() == 1); } p->thread_finished(); @@ -43,8 +42,8 @@ int eThread::runAsync(int prio, int policy) return -1; eDebug("after: %d", m_state.value()); - assert(m_state.value() == 1); /* sync postconditions */ - assert(!m_alive); + ASSERT(m_state.value() == 1); /* sync postconditions */ + ASSERT(!m_alive); m_state.down(); m_alive = 1; @@ -91,17 +90,18 @@ int eThread::sync(void) int res; m_state.down(); /* this might block */ res = m_alive; - assert(m_state.value() == 0); + ASSERT(m_state.value() == 0); m_state.up(); return res; /* 0: thread is guaranteed not to run. 1: state unknown. */ } -void eThread::sendSignal(int sig) +int eThread::sendSignal(int sig) { if (m_alive) - pthread_kill(the_thread, sig); + return pthread_kill(the_thread, sig); else eDebug("send signal to non running thread"); + return -1; } void eThread::kill(bool sendcancel) @@ -120,6 +120,6 @@ void eThread::kill(bool sendcancel) void eThread::hasStarted() { - assert(!m_state.value()); + ASSERT(!m_state.value()); m_state.up(); }