summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2005-12-11 12:10:28 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2005-12-11 12:10:28 +0100
commit72759ed1313982aaade3a380fe5beddfffc7824b (patch)
tree4ec561a605d146d62cec61be49068279c9ae2acb /thread.c
parent506b0de497f8abb407df3ff8a82d2253f8967c5d (diff)
downloadvdr-72759ed1313982aaade3a380fe5beddfffc7824b.tar.gz
vdr-72759ed1313982aaade3a380fe5beddfffc7824b.tar.bz2
Now using the gettid() syscall to get a thread's pid, so that we get a useful value on NPTL systems
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/thread.c b/thread.c
index 52747730..bf5ef6a2 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.46 2005/11/27 15:15:53 kls Exp $
+ * $Id: thread.c 1.47 2005/12/11 12:09:24 kls Exp $
*/
#include "thread.h"
@@ -12,6 +12,7 @@
#include <malloc.h>
#include <stdarg.h>
#include <sys/resource.h>
+#include <sys/syscall.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <unistd.h>
@@ -231,10 +232,10 @@ void cThread::SetDescription(const char *Description, ...)
void *cThread::StartThread(cThread *Thread)
{
if (Thread->description)
- dsyslog("%s thread started (pid=%d, tid=%ld)", Thread->description, getpid(), pthread_self());
+ dsyslog("%s thread started (pid=%d, tid=%d)", Thread->description, getpid(), ThreadId());
Thread->Action();
if (Thread->description)
- dsyslog("%s thread ended (pid=%d, tid=%ld)", Thread->description, getpid(), pthread_self());
+ dsyslog("%s thread ended (pid=%d, tid=%d)", Thread->description, getpid(), ThreadId());
Thread->running = false;
Thread->active = false;
return NULL;
@@ -308,6 +309,13 @@ bool cThread::EmergencyExit(bool Request)
return emergencyExitRequested = true; // yes, it's an assignment, not a comparison!
}
+_syscall0(pid_t, gettid)
+
+tThreadId cThread::ThreadId(void)
+{
+ return gettid();
+}
+
// --- cMutexLock ------------------------------------------------------------
cMutexLock::cMutexLock(cMutex *Mutex)