aboutsummaryrefslogtreecommitdiff
path: root/lib/base/thread.cpp
diff options
context:
space:
mode:
authorFraxinas <andreas.frisch@multimedia-labs.de>2009-05-20 11:24:18 +0200
committerFraxinas <andreas.frisch@multimedia-labs.de>2009-05-20 11:24:18 +0200
commit0c306d0eff685d81732fae1d1b0a6f951c27bd63 (patch)
tree64f6253503a47d853db6124b1a0ee5b8ed1467a8 /lib/base/thread.cpp
parent258b45224b4ab38d8019b8bcd9f51d5143719b4a (diff)
parent4ae68fe4023fe08deee027c9da0ce10fe70f75da (diff)
downloadenigma2-0c306d0eff685d81732fae1d1b0a6f951c27bd63.tar.gz
enigma2-0c306d0eff685d81732fae1d1b0a6f951c27bd63.zip
Merge branch 'master' of fraxinas@git.opendreambox.org:/git/enigma2
Diffstat (limited to 'lib/base/thread.cpp')
-rw-r--r--lib/base/thread.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/base/thread.cpp b/lib/base/thread.cpp
index 58c4fd72..fa923deb 100644
--- a/lib/base/thread.cpp
+++ b/lib/base/thread.cpp
@@ -9,12 +9,9 @@ void eThread::thread_completed(void *ptr)
eThread *p = (eThread*) ptr;
p->m_alive = 0;
- /* recover state */
- if (!p->m_state.value())
- {
- p->m_state.up();
- ASSERT(p->m_state.value() == 1);
- }
+ /* recover state in case thread was cancelled before calling hasStarted */
+ if (!p->m_started)
+ p->hasStarted();
p->thread_finished();
}
@@ -48,6 +45,7 @@ int eThread::runAsync(int prio, int policy)
ASSERT(m_state.value() == 0);
m_alive = 1;
+ m_started = 0;
/* start thread. */
pthread_attr_t attr;
@@ -125,5 +123,6 @@ void eThread::kill(bool sendcancel)
void eThread::hasStarted()
{
ASSERT(!m_state.value());
+ m_started = 1;
m_state.up();
}