From 72759ed1313982aaade3a380fe5beddfffc7824b Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 11 Dec 2005 12:10:28 +0100 Subject: Now using the gettid() syscall to get a thread's pid, so that we get a useful value on NPTL systems --- thread.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'thread.c') 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 #include #include +#include #include #include #include @@ -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) -- cgit v1.2.3