From 0b1a82aa5e3d6d0b699d850f249a763b4f137f7e Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 14 Oct 2003 01:27:31 +0000 Subject: [PATCH] Added check for pthread.h (reported by Steven Edwards). Removed init_done check, the process heap is now created before kernel is loaded anyway. --- configure | 2 ++ configure.ac | 1 + dlls/kernel/pthread.c | 12 ++++------- include/config.h.in | 3 +++ libs/wine/port.c | 49 ++++++++++++++++++++++++------------------- 5 files changed, 37 insertions(+), 30 deletions(-) diff --git a/configure b/configure index 2d149cc2863..bf4dd7d611f 100755 --- a/configure +++ b/configure @@ -13872,6 +13872,7 @@ done + for ac_header in \ @@ -13903,6 +13904,7 @@ for ac_header in \ netinet/tcp.h \ netinet/tcp_fsm.h \ openssl/ssl.h \ + pthread.h \ pty.h \ pwd.h \ regex.h \ diff --git a/configure.ac b/configure.ac index acb71d3779b..b8852eccfe7 100644 --- a/configure.ac +++ b/configure.ac @@ -1020,6 +1020,7 @@ AC_CHECK_HEADERS(\ netinet/tcp.h \ netinet/tcp_fsm.h \ openssl/ssl.h \ + pthread.h \ pty.h \ pwd.h \ regex.h \ diff --git a/dlls/kernel/pthread.c b/dlls/kernel/pthread.c index 7fd4754cc11..4104a4f7581 100644 --- a/dlls/kernel/pthread.c +++ b/dlls/kernel/pthread.c @@ -22,6 +22,8 @@ #include "config.h" #include "wine/port.h" +#ifdef HAVE_PTHREAD_H + #define _GNU_SOURCE /* we may need to override some GNU extensions */ #include @@ -53,8 +55,6 @@ static const struct wine_pthread_functions functions; DECL_GLOBAL_CONSTRUCTOR(pthread_init) { wine_pthread_init_process( &functions ); } -static inline int init_done(void) { return GetProcessHeap() != 0; } - /* NOTE: This is a truly extremely incredibly ugly hack! * But it does seem to work... */ @@ -176,7 +176,6 @@ static void mutex_real_init( pthread_mutex_t *mutex ) static int wine_pthread_mutex_lock(pthread_mutex_t *mutex) { - if (!init_done()) return 0; if (!((wine_mutex)mutex)->critsect) mutex_real_init( mutex ); @@ -186,7 +185,6 @@ static int wine_pthread_mutex_lock(pthread_mutex_t *mutex) static int wine_pthread_mutex_trylock(pthread_mutex_t *mutex) { - if (!init_done()) return 0; if (!((wine_mutex)mutex)->critsect) mutex_real_init( mutex ); @@ -251,7 +249,6 @@ static int wine_pthread_rwlock_destroy(pthread_rwlock_t *rwlock) static int wine_pthread_rwlock_rdlock(pthread_rwlock_t *rwlock) { - if (!init_done()) return 0; if (!((wine_rwlock)rwlock)->lock) rwlock_real_init( rwlock ); @@ -262,7 +259,6 @@ static int wine_pthread_rwlock_rdlock(pthread_rwlock_t *rwlock) static int wine_pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock) { - if (!init_done()) return 0; if (!((wine_rwlock)rwlock)->lock) rwlock_real_init( rwlock ); @@ -275,7 +271,6 @@ static int wine_pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock) static int wine_pthread_rwlock_wrlock(pthread_rwlock_t *rwlock) { - if (!init_done()) return 0; if (!((wine_rwlock)rwlock)->lock) rwlock_real_init( rwlock ); @@ -286,7 +281,6 @@ static int wine_pthread_rwlock_wrlock(pthread_rwlock_t *rwlock) static int wine_pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock) { - if (!init_done()) return 0; if (!((wine_rwlock)rwlock)->lock) rwlock_real_init( rwlock ); @@ -585,3 +579,5 @@ static const struct wine_pthread_functions functions = wine_pthread_cond_wait, /* ptr_pthread_cond_wait */ wine_pthread_cond_timedwait /* ptr_pthread_cond_timedwait */ }; + +#endif /* HAVE_PTHREAD_H */ diff --git a/include/config.h.in b/include/config.h.in index d80532a879e..acb44f4bc27 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -395,6 +395,9 @@ /* Define to 1 if you have the `pread' function. */ #undef HAVE_PREAD +/* Define to 1 if you have the header file. */ +#undef HAVE_PTHREAD_H + /* Define to 1 if the system has the type `pthread_rwlockattr_t'. */ #undef HAVE_PTHREAD_RWLOCKATTR_T diff --git a/libs/wine/port.c b/libs/wine/port.c index ee54806bae6..d6751fb4b0c 100644 --- a/libs/wine/port.c +++ b/libs/wine/port.c @@ -38,8 +38,35 @@ #endif #include "wine/library.h" + +#ifdef HAVE_PTHREAD_H + #include "wine/pthread.h" +/*********************************************************************** + * wine_pthread_init_process + * + * This function is just a placeholder, it will be overridden by the pthread support code. + */ +void wine_pthread_init_process( const struct wine_pthread_functions *functions ) +{ + assert(0); /* we must never get here */ +} + + +/*********************************************************************** + * wine_pthread_init_thread + * + * This function is just a placeholder, it will be overridden by the pthread support code. + */ +void wine_pthread_init_thread(void) +{ + assert(0); /* we must never get here */ +} + +#endif /* HAVE_PTHREAD_H */ + + /*********************************************************************** * wine_switch_to_stack * @@ -93,28 +120,6 @@ __ASM_GLOBAL_FUNC( wine_switch_to_stack, #endif -/*********************************************************************** - * wine_pthread_init_process - * - * This function is just a placeholder, it will be overridden by the pthread support code. - */ -void wine_pthread_init_process( const struct wine_pthread_functions *functions ) -{ - assert(0); /* we must never get here */ -} - - -/*********************************************************************** - * wine_pthread_init_thread - * - * This function is just a placeholder, it will be overridden by the pthread support code. - */ -void wine_pthread_init_thread(void) -{ - assert(0); /* we must never get here */ -} - - #if (defined(__svr4__) || defined(__NetBSD__)) && !defined(MAP_TRYFIXED) /*********************************************************************** * try_mmap_fixed