]> code.citadel.org Git - citadel.git/blobdiff - citadel/threads.c
* ctdl_internal_thread_func(): just use SYS_gettid if the system provides it. thit...
[citadel.git] / citadel / threads.c
index fb854bf575280c9a75b47e6e1b0f38ec0d546fcf..b3f13a02e37e850f305e1b01c2412c5f7c36acc9 100644 (file)
@@ -18,6 +18,7 @@
 #include <fcntl.h>
 #include <signal.h>
 
+#include "sysdep.h"
 #if TIME_WITH_SYS_TIME
 # include <sys/time.h>
 # include <time.h>
 # endif
 #endif
 
+#ifdef HAVE_SYSCALL_H
+# include <syscall.h>
+#else 
+# if HAVE_SYS_SYSCALL_H
+#  include <sys/syscall.h>
+# endif
+#endif
+
 #include <libcitadel.h>
 
 #include "threads.h"
@@ -839,6 +848,9 @@ static void *ctdl_internal_thread_func (void *arg)
        #endif
        
        // Tell the world we are here
+#if defined(HAVE_SYSCALL_H) && defined (SYS_gettid)
+       this_thread->reltid = syscall(SYS_gettid);
+#endif
        CtdlLogPrintf(CTDL_NOTICE, "Created a new thread \"%s\" (0x%08lx).\n",
                this_thread->name, this_thread->tid);
        
@@ -989,7 +1001,6 @@ CtdlThreadNode *ctdl_internal_create_thread(char *name, long flags, void *(*thre
                free(this_thread);
                return NULL;
        }
-       
        num_threads++;  // Increase the count of threads in the system.
        if(this_thread->flags & CTDLTHREAD_WORKER)
                num_workers++;