diff options
| author | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2007-01-30 23:32:15 +0000 |
|---|---|---|
| committer | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2007-01-30 23:32:15 +0000 |
| commit | 5655fee2e15bf1cfc0fe06a85e3c864dbfcd41ce (patch) | |
| tree | 04b2ca81ee83f3fad88ef645d42a04c53f02563a | |
| parent | 05ced3ba36c17c6a13ebb038dee5546c61576ce2 (diff) | |
| download | enigma2-5655fee2e15bf1cfc0fe06a85e3c864dbfcd41ce.tar.gz enigma2-5655fee2e15bf1cfc0fe06a85e3c864dbfcd41ce.zip | |
add a workaround to ensure that the filepush thread take notice of the
stop thread signal even when no syscall is in progress
| -rw-r--r-- | lib/base/filepush.cpp | 10 | ||||
| -rw-r--r-- | lib/base/thread.cpp | 5 | ||||
| -rw-r--r-- | lib/base/thread.h | 2 |
3 files changed, 13 insertions, 4 deletions
diff --git a/lib/base/filepush.cpp b/lib/base/filepush.cpp index 554c7845..8424ae41 100644 --- a/lib/base/filepush.cpp +++ b/lib/base/filepush.cpp @@ -176,7 +176,15 @@ void eFilePushThread::stop() return; m_stop = 1; - sendSignal(SIGUSR1); + + // fixmee.. here we need a better solution to ensure + // that the thread context take notice of the signal + // even when no syscall is in progress + while(!sendSignal(SIGUSR1)) + { + eDebug("send SIGUSR1 to thread context"); + usleep(5000); // wait msek + } kill(); } diff --git a/lib/base/thread.cpp b/lib/base/thread.cpp index 5353707d..9878856e 100644 --- a/lib/base/thread.cpp +++ b/lib/base/thread.cpp @@ -96,12 +96,13 @@ int eThread::sync(void) 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) diff --git a/lib/base/thread.h b/lib/base/thread.h index 819c51fe..12c5b25c 100644 --- a/lib/base/thread.h +++ b/lib/base/thread.h @@ -51,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); |
