mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Now using the gettid() syscall to get a thread's pid, so that we get a useful value on NPTL systems
This commit is contained in:
parent
506b0de497
commit
72759ed131
@ -1454,6 +1454,8 @@ Michael Reinelt <reinelt@eunet.at>
|
|||||||
Johannes Stezenbach <js@linuxtv.org>
|
Johannes Stezenbach <js@linuxtv.org>
|
||||||
for pointing out that the byte swap for big endian systems in cDvbOsd::Flush()
|
for pointing out that the byte swap for big endian systems in cDvbOsd::Flush()
|
||||||
is wrong
|
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>
|
Paavo Hartikainen <pahartik@sci.fi>
|
||||||
for verifying that the byte swap for big endian systems in cDvbOsd::Flush() was
|
for verifying that the byte swap for big endian systems in cDvbOsd::Flush() was
|
||||||
|
4
HISTORY
4
HISTORY
@ -3963,7 +3963,7 @@ Video Disk Recorder Revision History
|
|||||||
commands may now be executed at any time, and the message will be displayed
|
commands may now be executed at any time, and the message will be displayed
|
||||||
(no more "pending message").
|
(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
|
- Fixed handling second audio and Dolby Digital PIDs for encrypted channels
|
||||||
(was broken in version 1.3.37).
|
(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
|
- Now checking the channel's symbol rate in order to avoid problems on full
|
||||||
featured DVB cards with symbol rates below 10000.
|
featured DVB cards with symbol rates below 10000.
|
||||||
- Limited the frequency of log messages from the cRepackers.
|
- 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).
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Parts of this file were inspired by the 'ringbuffy.c' from the
|
* Parts of this file were inspired by the 'ringbuffy.c' from the
|
||||||
* LinuxDVB driver (see linuxtv.org).
|
* 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"
|
#include "ringbuffer.h"
|
||||||
@ -46,7 +46,7 @@ void cRingBuffer::UpdatePercentage(int Fill)
|
|||||||
int percent = Fill * 100 / (Size() - 1) / PERCENTAGEDELTA * PERCENTAGEDELTA;
|
int percent = Fill * 100 / (Size() - 1) / PERCENTAGEDELTA * PERCENTAGEDELTA;
|
||||||
if (percent != lastPercent) {
|
if (percent != lastPercent) {
|
||||||
if (percent >= PERCENTAGETHRESHOLD && percent > lastPercent || percent < PERCENTAGETHRESHOLD && lastPercent >= PERCENTAGETHRESHOLD) {
|
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;
|
lastPercent = percent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -286,7 +286,7 @@ uchar *cRingBufferLinear::Get(int &Count)
|
|||||||
uchar *p = NULL;
|
uchar *p = NULL;
|
||||||
int Head = head;
|
int Head = head;
|
||||||
if (getThreadTid <= 0)
|
if (getThreadTid <= 0)
|
||||||
getThreadTid = pthread_self();
|
getThreadTid = cThread::ThreadId();
|
||||||
int rest = Size() - tail;
|
int rest = Size() - tail;
|
||||||
if (rest < margin && Head < tail) {
|
if (rest < margin && Head < tail) {
|
||||||
int t = margin - rest;
|
int t = margin - rest;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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
|
#ifndef __RINGBUFFER_H
|
||||||
@ -23,7 +23,7 @@ private:
|
|||||||
int overflowCount;
|
int overflowCount;
|
||||||
int overflowBytes;
|
int overflowBytes;
|
||||||
protected:
|
protected:
|
||||||
pthread_t getThreadTid;
|
tThreadId getThreadTid;
|
||||||
int maxFill;//XXX
|
int maxFill;//XXX
|
||||||
int lastPercent;
|
int lastPercent;
|
||||||
bool statistics;//XXX
|
bool statistics;//XXX
|
||||||
|
14
thread.c
14
thread.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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"
|
#include "thread.h"
|
||||||
@ -12,6 +12,7 @@
|
|||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
#include <sys/syscall.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -231,10 +232,10 @@ void cThread::SetDescription(const char *Description, ...)
|
|||||||
void *cThread::StartThread(cThread *Thread)
|
void *cThread::StartThread(cThread *Thread)
|
||||||
{
|
{
|
||||||
if (Thread->description)
|
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();
|
Thread->Action();
|
||||||
if (Thread->description)
|
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->running = false;
|
||||||
Thread->active = false;
|
Thread->active = false;
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -308,6 +309,13 @@ bool cThread::EmergencyExit(bool Request)
|
|||||||
return emergencyExitRequested = true; // yes, it's an assignment, not a comparison!
|
return emergencyExitRequested = true; // yes, it's an assignment, not a comparison!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_syscall0(pid_t, gettid)
|
||||||
|
|
||||||
|
tThreadId cThread::ThreadId(void)
|
||||||
|
{
|
||||||
|
return gettid();
|
||||||
|
}
|
||||||
|
|
||||||
// --- cMutexLock ------------------------------------------------------------
|
// --- cMutexLock ------------------------------------------------------------
|
||||||
|
|
||||||
cMutexLock::cMutexLock(cMutex *Mutex)
|
cMutexLock::cMutexLock(cMutex *Mutex)
|
||||||
|
6
thread.h
6
thread.h
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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
|
#ifndef __THREAD_H
|
||||||
@ -72,7 +72,7 @@ public:
|
|||||||
void Unlock(void);
|
void Unlock(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef pthread_t tThreadId;
|
typedef pid_t tThreadId;
|
||||||
|
|
||||||
class cThread {
|
class cThread {
|
||||||
friend class cThreadLock;
|
friend class cThreadLock;
|
||||||
@ -115,7 +115,7 @@ public:
|
|||||||
bool Active(void);
|
bool Active(void);
|
||||||
///< Checks whether the thread is still alive.
|
///< Checks whether the thread is still alive.
|
||||||
static bool EmergencyExit(bool Request = false);
|
static bool EmergencyExit(bool Request = false);
|
||||||
static tThreadId ThreadId(void) { return pthread_self(); }
|
static tThreadId ThreadId(void);
|
||||||
static tThreadId IsMainThread(void) { return ThreadId() == mainThreadId; }
|
static tThreadId IsMainThread(void) { return ThreadId() == mainThreadId; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user