add a workaround to ensure that the filepush thread take notice of the
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Tue, 30 Jan 2007 23:32:15 +0000 (23:32 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Tue, 30 Jan 2007 23:32:15 +0000 (23:32 +0000)
stop thread signal even when no syscall is in progress

lib/base/filepush.cpp
lib/base/thread.cpp
lib/base/thread.h

index 554c7845c1d830c3e63c778a02f6ec7bfbf3006c..8424ae4197fd219469d3702b2c7be4f68e60b89f 100644 (file)
@@ -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();
 }
 
index 5353707dc9564f57f5a34476c6e8b558db360bcb..9878856eaa483007ccaa7d92f42043645c49a835 100644 (file)
@@ -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)
index 819c51fe530ea9186ea8dddaa76a246a20cbd091..12c5b25cbaba0c1c72f4e4ea9549d2320b9f566c 100644 (file)
@@ -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);