Commit 0b1a82aa authored by Alexandre Julliard's avatar Alexandre Julliard

Added check for pthread.h (reported by Steven Edwards).

Removed init_done check, the process heap is now created before kernel is loaded anyway.
parent 4034ff36
...@@ -13874,6 +13874,7 @@ done ...@@ -13874,6 +13874,7 @@ done
for ac_header in \ for ac_header in \
arpa/inet.h \ arpa/inet.h \
arpa/nameser.h \ arpa/nameser.h \
...@@ -13903,6 +13904,7 @@ for ac_header in \ ...@@ -13903,6 +13904,7 @@ for ac_header in \
netinet/tcp.h \ netinet/tcp.h \
netinet/tcp_fsm.h \ netinet/tcp_fsm.h \
openssl/ssl.h \ openssl/ssl.h \
pthread.h \
pty.h \ pty.h \
pwd.h \ pwd.h \
regex.h \ regex.h \
......
...@@ -1020,6 +1020,7 @@ AC_CHECK_HEADERS(\ ...@@ -1020,6 +1020,7 @@ AC_CHECK_HEADERS(\
netinet/tcp.h \ netinet/tcp.h \
netinet/tcp_fsm.h \ netinet/tcp_fsm.h \
openssl/ssl.h \ openssl/ssl.h \
pthread.h \
pty.h \ pty.h \
pwd.h \ pwd.h \
regex.h \ regex.h \
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#include "config.h" #include "config.h"
#include "wine/port.h" #include "wine/port.h"
#ifdef HAVE_PTHREAD_H
#define _GNU_SOURCE /* we may need to override some GNU extensions */ #define _GNU_SOURCE /* we may need to override some GNU extensions */
#include <assert.h> #include <assert.h>
...@@ -53,8 +55,6 @@ static const struct wine_pthread_functions functions; ...@@ -53,8 +55,6 @@ static const struct wine_pthread_functions functions;
DECL_GLOBAL_CONSTRUCTOR(pthread_init) { wine_pthread_init_process( &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! /* NOTE: This is a truly extremely incredibly ugly hack!
* But it does seem to work... */ * But it does seem to work... */
...@@ -176,7 +176,6 @@ static void mutex_real_init( pthread_mutex_t *mutex ) ...@@ -176,7 +176,6 @@ static void mutex_real_init( pthread_mutex_t *mutex )
static int wine_pthread_mutex_lock(pthread_mutex_t *mutex) static int wine_pthread_mutex_lock(pthread_mutex_t *mutex)
{ {
if (!init_done()) return 0;
if (!((wine_mutex)mutex)->critsect) if (!((wine_mutex)mutex)->critsect)
mutex_real_init( mutex ); mutex_real_init( mutex );
...@@ -186,7 +185,6 @@ static int wine_pthread_mutex_lock(pthread_mutex_t *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) static int wine_pthread_mutex_trylock(pthread_mutex_t *mutex)
{ {
if (!init_done()) return 0;
if (!((wine_mutex)mutex)->critsect) if (!((wine_mutex)mutex)->critsect)
mutex_real_init( mutex ); mutex_real_init( mutex );
...@@ -251,7 +249,6 @@ static int wine_pthread_rwlock_destroy(pthread_rwlock_t *rwlock) ...@@ -251,7 +249,6 @@ static int wine_pthread_rwlock_destroy(pthread_rwlock_t *rwlock)
static int wine_pthread_rwlock_rdlock(pthread_rwlock_t *rwlock) static int wine_pthread_rwlock_rdlock(pthread_rwlock_t *rwlock)
{ {
if (!init_done()) return 0;
if (!((wine_rwlock)rwlock)->lock) if (!((wine_rwlock)rwlock)->lock)
rwlock_real_init( rwlock ); rwlock_real_init( rwlock );
...@@ -262,7 +259,6 @@ static int wine_pthread_rwlock_rdlock(pthread_rwlock_t *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) static int wine_pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock)
{ {
if (!init_done()) return 0;
if (!((wine_rwlock)rwlock)->lock) if (!((wine_rwlock)rwlock)->lock)
rwlock_real_init( rwlock ); rwlock_real_init( rwlock );
...@@ -275,7 +271,6 @@ static int wine_pthread_rwlock_tryrdlock(pthread_rwlock_t *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) static int wine_pthread_rwlock_wrlock(pthread_rwlock_t *rwlock)
{ {
if (!init_done()) return 0;
if (!((wine_rwlock)rwlock)->lock) if (!((wine_rwlock)rwlock)->lock)
rwlock_real_init( rwlock ); rwlock_real_init( rwlock );
...@@ -286,7 +281,6 @@ static int wine_pthread_rwlock_wrlock(pthread_rwlock_t *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) static int wine_pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock)
{ {
if (!init_done()) return 0;
if (!((wine_rwlock)rwlock)->lock) if (!((wine_rwlock)rwlock)->lock)
rwlock_real_init( rwlock ); rwlock_real_init( rwlock );
...@@ -585,3 +579,5 @@ static const struct wine_pthread_functions functions = ...@@ -585,3 +579,5 @@ static const struct wine_pthread_functions functions =
wine_pthread_cond_wait, /* ptr_pthread_cond_wait */ wine_pthread_cond_wait, /* ptr_pthread_cond_wait */
wine_pthread_cond_timedwait /* ptr_pthread_cond_timedwait */ wine_pthread_cond_timedwait /* ptr_pthread_cond_timedwait */
}; };
#endif /* HAVE_PTHREAD_H */
...@@ -395,6 +395,9 @@ ...@@ -395,6 +395,9 @@
/* Define to 1 if you have the `pread' function. */ /* Define to 1 if you have the `pread' function. */
#undef HAVE_PREAD #undef HAVE_PREAD
/* Define to 1 if you have the <pthread.h> header file. */
#undef HAVE_PTHREAD_H
/* Define to 1 if the system has the type `pthread_rwlockattr_t'. */ /* Define to 1 if the system has the type `pthread_rwlockattr_t'. */
#undef HAVE_PTHREAD_RWLOCKATTR_T #undef HAVE_PTHREAD_RWLOCKATTR_T
......
...@@ -38,9 +38,36 @@ ...@@ -38,9 +38,36 @@
#endif #endif
#include "wine/library.h" #include "wine/library.h"
#ifdef HAVE_PTHREAD_H
#include "wine/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 * wine_switch_to_stack
* *
* Switch to the specified stack and call the function. * Switch to the specified stack and call the function.
...@@ -93,28 +120,6 @@ __ASM_GLOBAL_FUNC( wine_switch_to_stack, ...@@ -93,28 +120,6 @@ __ASM_GLOBAL_FUNC( wine_switch_to_stack,
#endif #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) #if (defined(__svr4__) || defined(__NetBSD__)) && !defined(MAP_TRYFIXED)
/*********************************************************************** /***********************************************************************
* try_mmap_fixed * try_mmap_fixed
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment