Commit bb677d45 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Linux: vlc_threadid() returns TID instead of kludging pthread_self()

parent 36de72f0
...@@ -41,6 +41,9 @@ ...@@ -41,6 +41,9 @@
#if defined( LIBVLC_USE_PTHREAD ) #if defined( LIBVLC_USE_PTHREAD )
# include <sched.h> # include <sched.h>
# ifdef __linux__
# include <sys/syscall.h> /* SYS_gettid */
# endif
#else #else
static vlc_threadvar_t cancel_key; static vlc_threadvar_t cancel_key;
#endif #endif
...@@ -68,11 +71,16 @@ void vlc_trace (const char *fn, const char *file, unsigned line) ...@@ -68,11 +71,16 @@ void vlc_trace (const char *fn, const char *file, unsigned line)
static inline unsigned long vlc_threadid (void) static inline unsigned long vlc_threadid (void)
{ {
#if defined(LIBVLC_USE_PTHREAD) #if defined (LIBVLC_USE_PTHREAD)
# if defined (__linux__)
return syscall (SYS_gettid);
# else
union { pthread_t th; unsigned long int i; } v = { }; union { pthread_t th; unsigned long int i; } v = { };
v.th = pthread_self (); v.th = pthread_self ();
return v.i; return v.i;
#endif
#elif defined (WIN32) #elif defined (WIN32)
return GetCurrentThreadId (); return GetCurrentThreadId ();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment