[vdr] VDR gets somehow stuck and consumes all CPU time

Johannes Stezenbach js at linuxtv.org
Sat Dec 10 17:42:04 CET 2005


Klaus Schmidinger wrote:
> Johannes Stezenbach wrote:
> >...
> >pthread_self() has to be used within programs using to identify
> >the threads. gettid() is more a debugging aid as the return value
> >of pthread_self() has no meaning outside the context of the running
> >program. (Funny that glibc doesn't have a syscall wrapper for
> >gettid(); dietlibc has.)
> 
> Thanks, this appears to work just fine.
> 
> I assume it's ok to use the SYS_gettid macro, as in
> 
> 
> 
> #include <sys/syscall.h>
> 
> static inline pid_t gettid(void)
> {
>   return syscall(SYS_gettid);
> }
> 
> 
> 
> instead of the hardcoded 224.

The man page actually suggests:
http://homepages.cwi.nl/~aeb/linux/man2html/man2/gettid.2.html

#include <sys/types.h>
#include <linux/unistd.h>

_syscall0(pid_t,gettid)

(I just made a mistake and included <unistd.h> instead of <linux/unistd.h>
so it didn't work when I initially tested it.)

Johannes



More information about the vdr mailing list