summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2004-10-24 11:12:05 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2004-10-24 11:12:05 +0200
commit9f51fcad223572c459e7fc0705dfba44da38aaad (patch)
tree35dd9798d445f3c9b9a67542a1ed70d754564393 /thread.c
parent70e60380562fb25a7acce9b47c75842d60722dd0 (diff)
downloadvdr-9f51fcad223572c459e7fc0705dfba44da38aaad.tar.gz
vdr-9f51fcad223572c459e7fc0705dfba44da38aaad.tar.bz2
Added cCondWait::Sleep() and using it to replace all usleep() calls
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/thread.c b/thread.c
index 730fa733..144563df 100644
--- a/thread.c
+++ b/thread.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: thread.c 1.34 2004/10/24 10:27:47 kls Exp $
+ * $Id: thread.c 1.35 2004/10/24 11:05:56 kls Exp $
*/
#include "thread.h"
@@ -32,6 +32,12 @@ cCondWait::~cCondWait()
pthread_mutex_destroy(&mutex);
}
+void cCondWait::SleepMs(int TimeoutMs)
+{
+ cCondWait w;
+ w.Wait(TimeoutMs);
+}
+
bool cCondWait::Wait(int TimeoutMs)
{
pthread_mutex_lock(&mutex);
@@ -265,7 +271,7 @@ void cThread::Cancel(int WaitSeconds)
for (time_t t0 = time(NULL) + WaitSeconds; time(NULL) < t0; ) {
if (!Active())
return;
- usleep(10000);
+ cCondWait::SleepMs(10);
}
esyslog("ERROR: thread %ld won't end (waited %d seconds) - cancelling it...", childTid, WaitSeconds);
}
@@ -433,7 +439,7 @@ int cPipe::Close(void)
else if (ret == pid)
break;
i--;
- usleep(100000);
+ cCondWait::SleepMs(100);
}
if (!i) {
kill(pid, SIGKILL);