git.cweiske.de
/
enigma2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
epgcache.h/cpp: add viasat (sirus 5°E) EPG
[enigma2.git]
/
lib
/
base
/
thread.cpp
diff --git
a/lib/base/thread.cpp
b/lib/base/thread.cpp
index ceb50bfe350c3dbab479f9150f066ebdfff3f024..58c4fd72619a1064f2971fe265a0f41d3df8c5b7 100644
(file)
--- a/
lib/base/thread.cpp
+++ b/
lib/base/thread.cpp
@@
-13,8
+13,10
@@
void eThread::thread_completed(void *ptr)
if (!p->m_state.value())
{
p->m_state.up();
if (!p->m_state.value())
{
p->m_state.up();
-
assert
(p->m_state.value() == 1);
+
ASSERT
(p->m_state.value() == 1);
}
}
+
+ p->thread_finished();
}
void *eThread::wrapper(void *ptr)
}
void *eThread::wrapper(void *ptr)
@@
-40,9
+42,10
@@
int eThread::runAsync(int prio, int policy)
return -1;
eDebug("after: %d", m_state.value());
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_state.down();
+ ASSERT(m_state.value() == 0);
m_alive = 1;
m_alive = 1;
@@
-86,19
+89,23
@@
eThread::~eThread()
int eThread::sync(void)
{
int res;
int eThread::sync(void)
{
int res;
+ int debug_val_before = m_state.value();
m_state.down(); /* this might block */
res = m_alive;
m_state.down(); /* this might block */
res = m_alive;
- assert(m_state.value() == 0);
+ if (m_state.value() != 0)
+ eFatal("eThread::sync: m_state.value() == %d - was %d before", m_state.value(), debug_val_before);
+ ASSERT(m_state.value() == 0);
m_state.up();
return res; /* 0: thread is guaranteed not to run. 1: state unknown. */
}
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)
{
if (m_alive)
- pthread_kill(the_thread, sig);
+
return
pthread_kill(the_thread, sig);
else
eDebug("send signal to non running thread");
else
eDebug("send signal to non running thread");
+ return -1;
}
void eThread::kill(bool sendcancel)
}
void eThread::kill(bool sendcancel)
@@
-117,6
+124,6
@@
void eThread::kill(bool sendcancel)
void eThread::hasStarted()
{
void eThread::hasStarted()
{
-
assert
(!m_state.value());
+
ASSERT
(!m_state.value());
m_state.up();
}
m_state.up();
}