summaryrefslogtreecommitdiff
path: root/luaif/luaif.c
diff options
context:
space:
mode:
authorLauri Aarnio <Lauri.Aarnio@iki.fi>2008-10-08 17:58:41 +0300
committerLauri Leukkunen <lle@rahina.org>2008-10-18 15:18:14 +0300
commit0be0f95156ef67d505dbfe2aee7efbffdd0a4c76 (patch)
tree59584c9641a44efcf7061cdd060e0252a67bcc1d /luaif/luaif.c
parent5044503fe4a18abc3907b7634ac7f35d8bbb5c22 (diff)
Logging routines now print process and thread ids for multithreaded programs - initialization code (in luaif.c) detects if pthread_self is available, and the logger (sb_log.c) uses that to log PID/TID for multithreaded programs - if pthread library isn't available, only PID is logged
Diffstat (limited to 'luaif/luaif.c')
-rw-r--r--luaif/luaif.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/luaif/luaif.c b/luaif/luaif.c
index 6fdf77d..fe90080 100644
--- a/luaif/luaif.c
+++ b/luaif/luaif.c
@@ -48,7 +48,7 @@
* pthread library has already been loaded (most likely, by the real program
* that we are serving).
*/
-#include <pthread.h>
+
#include <dlfcn.h>
/* pointers to pthread library functions, if the pthread library is in use.
@@ -59,6 +59,7 @@ static void *(*pthread_getspecific_fnptr)(pthread_key_t key) = NULL;
static int (*pthread_setspecific_fnptr)(pthread_key_t key,
const void *value) = NULL;
static int (*pthread_once_fnptr)(pthread_once_t *, void (*)(void)) = NULL;
+pthread_t (*pthread_self_fnptr)(void) = NULL;
static void check_pthread_library()
{
@@ -73,6 +74,8 @@ static void check_pthread_library()
"pthread_setspecific");
pthread_once_fnptr = dlsym(RTLD_DEFAULT,
"pthread_once");
+ pthread_self_fnptr = dlsym(RTLD_DEFAULT,
+ "pthread_self");
if (pthread_key_create_fnptr &&
pthread_getspecific_fnptr &&