diff --git a/configure b/configure index c8e01fac549da542f06a430156a0e145a58ce939..e8c2ddf0a4f1e265adf3cedd59983082f6550c75 100755 --- a/configure +++ b/configure @@ -11543,6 +11543,11 @@ fi + + + + + @@ -11580,6 +11585,11 @@ for ac_func in \ pclose \ popen \ pread \ + pthread_getspecific \ + pthread_key_create \ + pthread_mutex_lock \ + pthread_mutex_unlock \ + pthread_setspecific \ pwrite \ rfork \ select \ diff --git a/configure.ac b/configure.ac index 3223e3e889c41980c44de1b4751536e5dfe44faa..c72b7399629ecfe6782e0dd39a8f3df3c16e6c9e 100644 --- a/configure.ac +++ b/configure.ac @@ -947,6 +947,11 @@ AC_CHECK_FUNCS(\ pclose \ popen \ pread \ + pthread_getspecific \ + pthread_key_create \ + pthread_mutex_lock \ + pthread_mutex_unlock \ + pthread_setspecific \ pwrite \ rfork \ select \ diff --git a/include/config.h.in b/include/config.h.in index 57a0439f9db25ccfdb5b57d2d292bb278c0b230f..a0124e6b63a2ca3e9d3be09a6aa6eb30290b099b 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -368,6 +368,21 @@ /* Define to 1 if you have the `pread' function. */ #undef HAVE_PREAD +/* Define to 1 if you have the `pthread_getspecific' function. */ +#undef HAVE_PTHREAD_GETSPECIFIC + +/* Define to 1 if you have the `pthread_key_create' function. */ +#undef HAVE_PTHREAD_KEY_CREATE + +/* Define to 1 if you have the `pthread_mutex_lock' function. */ +#undef HAVE_PTHREAD_MUTEX_LOCK + +/* Define to 1 if you have the `pthread_mutex_unlock' function. */ +#undef HAVE_PTHREAD_MUTEX_UNLOCK + +/* Define to 1 if you have the `pthread_setspecific' function. */ +#undef HAVE_PTHREAD_SETSPECIFIC + /* Define to 1 if you have the <pty.h> header file. */ #undef HAVE_PTY_H diff --git a/library/port.c b/library/port.c index 25fd4b739603daf26b1f3bb9cd4007004a05e6dc..ddb4283223b2d1cb9b05d3e061ba812697ebe276 100644 --- a/library/port.c +++ b/library/port.c @@ -679,6 +679,30 @@ void *wine_memcpy_unaligned( void *dst, const void *src, size_t size ) #endif +/*********************************************************************** + * pthread functions + */ + +#ifndef HAVE_PTHREAD_GETSPECIFIC +void pthread_getspecific() { assert(0); } +#endif + +#ifndef HAVE_PTHREAD_KEY_CREATE +void pthread_key_create() { assert(0); } +#endif + +#ifndef HAVE_PTHREAD_MUTEX_LOCK +void pthread_mutex_lock() { assert(0); } +#endif + +#ifndef HAVE_PTHREAD_MUTEX_UNLOCK +void pthread_mutex_unlock() { assert(0); } +#endif + +#ifndef HAVE_PTHREAD_SETSPECIFIC +void pthread_setspecific() { assert(0); } +#endif + /*********************************************************************** * interlocked functions */ diff --git a/scheduler/pthread.c b/scheduler/pthread.c index 7bf27f6723af760025aa89f740a4c3add0a8d827..bc5cf813f2b615310c6bdeefc58ac4241a7850af 100644 --- a/scheduler/pthread.c +++ b/scheduler/pthread.c @@ -44,7 +44,12 @@ * If they are not available, the libc defaults to * non-threadsafe operation (not good). */ -#if defined(__GLIBC__) +#if defined(__GLIBC__) || defined(__FreeBSD__) + +#ifndef __USE_UNIX98 +#define __USE_UNIX98 +#endif + #include <pthread.h> #include <signal.h> @@ -368,7 +373,7 @@ strong_alias(__pthread_mutexattr_setkind_np, pthread_mutexattr_setkind_np); int __pthread_mutexattr_getkind_np(pthread_mutexattr_t *attr, int *kind) { - *kind = PTHREAD_MUTEX_RECURSIVE_NP; + *kind = PTHREAD_MUTEX_RECURSIVE; return 0; } strong_alias(__pthread_mutexattr_getkind_np, pthread_mutexattr_getkind_np); @@ -381,7 +386,7 @@ strong_alias(__pthread_mutexattr_settype, pthread_mutexattr_settype); int __pthread_mutexattr_gettype(pthread_mutexattr_t *attr, int *kind) { - *kind = PTHREAD_MUTEX_RECURSIVE_NP; + *kind = PTHREAD_MUTEX_RECURSIVE; return 0; } strong_alias(__pthread_mutexattr_gettype, pthread_mutexattr_gettype);