diff --git a/src/modules/spider/lock.c b/src/modules/spider/lock.c index a22eaad5f906634c8305f1bb4ec4f1e4f54cc026..fa94ed26a83ae5d22135ffe38043a99476791558 100644 --- a/src/modules/spider/lock.c +++ b/src/modules/spider/lock.c @@ -1,5 +1,5 @@ #include "global.h" -#if defined(HAVE_PTHREAD_MUTEX_UNLOCK) || defined(HAVE_MUTEX_UNLOCK) +#if defined(_REENTRANT) || defined(HAVE_MUTEX_UNLOCK) #include <sys/types.h> @@ -93,7 +93,9 @@ mylock_t *newlock( int id ) { pthread_mutexattr_t attributes; pthread_mutexattr_init( &attributes ); +#ifdef PTHREAD_PROCESS_SHARED pthread_mutexattr_setpshared( &attributes, PTHREAD_PROCESS_SHARED ); +#endif pthread_mutex_init( &lock->lock, &attributes ); pthread_mutexattr_destroy( &attributes ); } diff --git a/src/modules/spider/sharedmem.c b/src/modules/spider/sharedmem.c index 6646e281a5a677de9b1c6f30475359341194242a..0ec9f24f899806e24ccdd367801d06795b7761c7 100644 --- a/src/modules/spider/sharedmem.c +++ b/src/modules/spider/sharedmem.c @@ -1,9 +1,10 @@ +#include "global.h" #include <sys/types.h> #ifdef HAVE_THREAD_H # include <thread.h> #else -# ifdef HAVE_PTHREAD_H +# if defined(_REENTRANT) && defined(HAVE_PTHREAD_H) # include <pthread.h> # endif #endif diff --git a/src/modules/spider/spider.c b/src/modules/spider/spider.c index 3d051f75f3bcdd82e0c5b38b742d0fac1b333f14..3c2cefca1559895834f3e1cdc9d19ad6ddb5d27a 100644 --- a/src/modules/spider/spider.c +++ b/src/modules/spider/spider.c @@ -1778,7 +1778,7 @@ void init_spider_efuns(void) "function(int:int)", OPT_SIDE_EFFECT); -#if defined(HAVE_PTHREAD_MUTEX_UNLOCK) || defined(HAVE_MUTEX_UNLOCK) +#if defined(_REENTRANT) || defined(HAVE_MUTEX_UNLOCK) add_efun("_lock", f_lock, "function(int:int)", OPT_SIDE_EFFECT); add_efun("_unlock", f_unlock, "function(int:int)", OPT_SIDE_EFFECT); add_efun("_free_lock", f_freelock, "function(int:int)", OPT_SIDE_EFFECT);