aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/base/filepush.cpp10
-rw-r--r--lib/base/thread.cpp5
-rw-r--r--lib/base/thread.h2
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);