VDR gets somehow stuck and consumes all CPU time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Stezenbach wrote:
> On Sat, Dec 03, 2005, Klaus Schmidinger wrote:
> 
>>(AFAIK with NPTL all threads
>>of a given program have the same pid, so you won't be able to
>>distinguish them in 'top').
> 
> 
> This is not entirely true, you can still see and distinguish
> the threads in htop or "ps -T u -C vdr" etc. (top does not work).
> 
> The patch below might help, gettid() returns the PID of the thread. (And
> since it's a syscall it is independent of NPTL vs. linuxthreads. Tested
> on 2.6 only, but the gettid man page says it's available in 2.4.20.
> gettid() is Linux specific.)

Does this "gettid" call return a different tid than "pthread_self()"?

I'm just wondering because the introduction of "pthread_self()" was one
of the things we had to change to make VDR run with NPTL...

Klaus

> Johannes
> 
> --- vdr-1.3.37/thread.c.orig	2005-12-03 19:52:38.000000000 +0100
> +++ vdr-1.3.37/thread.c	2005-12-03 20:12:47.000000000 +0100
> @@ -17,6 +17,11 @@
>  #include <unistd.h>
>  #include "tools.h"
>  
> +static inline pid_t gettid(void)
> +{
> +  return (pid_t) syscall(224);
> +}
> +
>  static bool GetAbsTime(struct timespec *Abstime, int MillisecondsFromNow)
>  {
>    struct timeval now;
> @@ -231,10 +236,10 @@ void cThread::SetDescription(const char 
>  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(), gettid());
>    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(), gettid());
>    Thread->running = false;
>    Thread->active = false;
>    return NULL;



[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux