summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTORS2
-rw-r--r--HISTORY4
-rw-r--r--ringbuffer.c6
-rw-r--r--ringbuffer.h4
-rw-r--r--thread.c14
-rw-r--r--thread.h6
6 files changed, 24 insertions, 12 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index f0005f48..6904d22f 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -1454,6 +1454,8 @@ Michael Reinelt <reinelt@eunet.at>
Johannes Stezenbach <js@linuxtv.org>
for pointing out that the byte swap for big endian systems in cDvbOsd::Flush()
is wrong
+ for suggesting to use gettid() syscall to get a thread's pid, so that we get a
+ useful value on NPTL systems
Paavo Hartikainen <pahartik@sci.fi>
for verifying that the byte swap for big endian systems in cDvbOsd::Flush() was
diff --git a/HISTORY b/HISTORY
index 1b20b2af..49412777 100644
--- a/HISTORY
+++ b/HISTORY
@@ -3963,7 +3963,7 @@ Video Disk Recorder Revision History
commands may now be executed at any time, and the message will be displayed
(no more "pending message").
-2005-12-03: Version 1.3.38
+2005-12-11: Version 1.3.38
- Fixed handling second audio and Dolby Digital PIDs for encrypted channels
(was broken in version 1.3.37).
@@ -3972,3 +3972,5 @@ Video Disk Recorder Revision History
- Now checking the channel's symbol rate in order to avoid problems on full
featured DVB cards with symbol rates below 10000.
- Limited the frequency of log messages from the cRepackers.
+- Now using the gettid() syscall to get a thread's pid, so that we get a
+ useful value on NPTL systems (suggested by Johannes Stezenbach).
diff --git a/ringbuffer.c b/ringbuffer.c
index 3473a9e7..167511a8 100644
--- a/ringbuffer.c
+++ b/ringbuffer.c
@@ -7,7 +7,7 @@
* Parts of this file were inspired by the 'ringbuffy.c' from the
* LinuxDVB driver (see linuxtv.org).
*
- * $Id: ringbuffer.c 1.21 2004/10/15 13:49:25 kls Exp $
+ * $Id: ringbuffer.c 1.22 2005/12/10 10:55:26 kls Exp $
*/
#include "ringbuffer.h"
@@ -46,7 +46,7 @@ void cRingBuffer::UpdatePercentage(int Fill)
int percent = Fill * 100 / (Size() - 1) / PERCENTAGEDELTA * PERCENTAGEDELTA;
if (percent != lastPercent) {
if (percent >= PERCENTAGETHRESHOLD && percent > lastPercent || percent < PERCENTAGETHRESHOLD && lastPercent >= PERCENTAGETHRESHOLD) {
- dsyslog("buffer usage: %d%% (tid=%ld)", percent, getThreadTid);
+ dsyslog("buffer usage: %d%% (tid=%d)", percent, getThreadTid);
lastPercent = percent;
}
}
@@ -286,7 +286,7 @@ uchar *cRingBufferLinear::Get(int &Count)
uchar *p = NULL;
int Head = head;
if (getThreadTid <= 0)
- getThreadTid = pthread_self();
+ getThreadTid = cThread::ThreadId();
int rest = Size() - tail;
if (rest < margin && Head < tail) {
int t = margin - rest;
diff --git a/ringbuffer.h b/ringbuffer.h
index c47aac3f..dba0e619 100644
--- a/ringbuffer.h
+++ b/ringbuffer.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: ringbuffer.h 1.16 2004/10/15 13:50:46 kls Exp $
+ * $Id: ringbuffer.h 1.17 2005/12/10 10:54:51 kls Exp $
*/
#ifndef __RINGBUFFER_H
@@ -23,7 +23,7 @@ private:
int overflowCount;
int overflowBytes;
protected:
- pthread_t getThreadTid;
+ tThreadId getThreadTid;
int maxFill;//XXX
int lastPercent;
bool statistics;//XXX
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)
diff --git a/thread.h b/thread.h
index 1b6200ce..e3bdccff 100644
--- a/thread.h
+++ b/thread.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: thread.h 1.32 2005/11/27 15:16:50 kls Exp $
+ * $Id: thread.h 1.33 2005/12/11 12:04:56 kls Exp $
*/
#ifndef __THREAD_H
@@ -72,7 +72,7 @@ public:
void Unlock(void);
};
-typedef pthread_t tThreadId;
+typedef pid_t tThreadId;
class cThread {
friend class cThreadLock;
@@ -115,7 +115,7 @@ public:
bool Active(void);
///< Checks whether the thread is still alive.
static bool EmergencyExit(bool Request = false);
- static tThreadId ThreadId(void) { return pthread_self(); }
+ static tThreadId ThreadId(void);
static tThreadId IsMainThread(void) { return ThreadId() == mainThreadId; }
};