Commit 80e34dbb authored by Alexandre Julliard's avatar Alexandre Julliard

Moved the implementation of the pthread wrappers to dlls/kernel.

parent 9cceea30
......@@ -1128,7 +1128,7 @@ _ASBOX
echo "$as_me: caught signal $ac_signal"
echo "$as_me: exit $exit_status"
} >&5
rm -f core core.* *.core &&
rm -f core *.core &&
rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
' 0
......@@ -6080,7 +6080,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_header_stdc=no
fi
rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
fi
......@@ -9962,6 +9962,122 @@ _ACEOF
fi
echo "$as_me:$LINENO: checking for pthread_rwlock_t" >&5
echo $ECHO_N "checking for pthread_rwlock_t... $ECHO_C" >&6
if test "${ac_cv_type_pthread_rwlock_t+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#define _GNU_SOURCE
#include <pthread.h>
int
main ()
{
if ((pthread_rwlock_t *) 0)
return 0;
if (sizeof (pthread_rwlock_t))
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_type_pthread_rwlock_t=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_type_pthread_rwlock_t=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_type_pthread_rwlock_t" >&5
echo "${ECHO_T}$ac_cv_type_pthread_rwlock_t" >&6
if test $ac_cv_type_pthread_rwlock_t = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_PTHREAD_RWLOCK_T 1
_ACEOF
fi
echo "$as_me:$LINENO: checking for pthread_rwlockattr_t" >&5
echo $ECHO_N "checking for pthread_rwlockattr_t... $ECHO_C" >&6
if test "${ac_cv_type_pthread_rwlockattr_t+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#define _GNU_SOURCE
#include <pthread.h>
int
main ()
{
if ((pthread_rwlockattr_t *) 0)
return 0;
if (sizeof (pthread_rwlockattr_t))
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_type_pthread_rwlockattr_t=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_type_pthread_rwlockattr_t=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_type_pthread_rwlockattr_t" >&5
echo "${ECHO_T}$ac_cv_type_pthread_rwlockattr_t" >&6
if test $ac_cv_type_pthread_rwlockattr_t = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_PTHREAD_RWLOCKATTR_T 1
_ACEOF
fi
......@@ -10841,7 +10957,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_mmap64_works="no"
fi
rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
echo "$as_me:$LINENO: result: $ac_cv_mmap64_works" >&5
......@@ -10911,7 +11027,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_c_gcc_strength_bug="yes"
fi
rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
echo "$as_me:$LINENO: result: $ac_cv_c_gcc_strength_bug" >&5
......@@ -12135,7 +12251,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_ld_reloc_exec="no"
fi
rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
CFLAGS="$saved_CFLAGS"
fi
......@@ -13437,7 +13553,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_c_stack_direction=-1
fi
rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5
......@@ -15177,7 +15293,7 @@ echo "$as_me: error: cannot compute sizeof (long long), 77
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
rm -f conftest.val
......
......@@ -520,6 +520,10 @@ then
AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy])
fi
dnl **** Check for pthread_rwlock_t ****
AC_CHECK_TYPES([pthread_rwlock_t, pthread_rwlockattr_t],,,[#define _GNU_SOURCE
#include <pthread.h>])
dnl **** Check for Open Sound System ****
AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h soundcard.h, break)
......
......@@ -39,6 +39,7 @@ C_SRCS = \
powermgnt.c \
process.c \
profile.c \
pthread.c \
relay16.c \
resource.c \
resource16.c \
......
......@@ -45,11 +45,8 @@
#include <sched.h>
#endif
#ifdef HAVE_NPTL
#include <pthread.h>
#endif
#include "thread.h"
#include "wine/pthread.h"
#include "wine/server.h"
#include "winbase.h"
#include "wine/library.h"
......@@ -70,7 +67,6 @@ struct thread_cleanup_info
static char temp_stacks[NB_TEMP_STACKS][TEMP_STACK_SIZE];
static LONG next_temp_stack; /* next temp stack to use */
extern void PTHREAD_init_thread(void);
/***********************************************************************
* SYSDEPS_SetCurThread
......@@ -102,7 +98,7 @@ void SYSDEPS_SetCurThread( TEB *teb )
#ifdef HAVE_NPTL
teb->pthread_data = (void *)pthread_self();
#else
PTHREAD_init_thread();
wine_pthread_init_thread();
#endif
}
......
......@@ -395,6 +395,12 @@
/* Define to 1 if you have the `pread' function. */
#undef HAVE_PREAD
/* Define to 1 if the system has the type `pthread_rwlockattr_t'. */
#undef HAVE_PTHREAD_RWLOCKATTR_T
/* Define to 1 if the system has the type `pthread_rwlock_t'. */
#undef HAVE_PTHREAD_RWLOCK_T
/* Define to 1 if you have the <pty.h> header file. */
#undef HAVE_PTY_H
......
/*
* Definitions for Wine pthread emulation
*
* Copyright 2003 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __WINE_WINE_PTHREAD_H
#define __WINE_WINE_PTHREAD_H
#define _GNU_SOURCE
#include <pthread.h>
#ifndef HAVE_PTHREAD_RWLOCK_T
typedef void *pthread_rwlock_t;
#endif
#ifndef HAVE_PTHREAD_RWLOCKATTR_T
typedef void *pthread_rwlockattr_t;
#endif
struct wine_pthread_functions
{
void * (*ptr_get_thread_data)(void);
void (*ptr_set_thread_data)(void *data);
pthread_t (*ptr_pthread_self)(void);
int (*ptr_pthread_equal)(pthread_t thread1, pthread_t thread2);
int (*ptr_pthread_create)(pthread_t* thread, const pthread_attr_t* attr,
void* (*start_routine)(void *), void* arg);
int (*ptr_pthread_cancel)(pthread_t thread);
int (*ptr_pthread_join)(pthread_t thread, void **value_ptr);
int (*ptr_pthread_detach)(pthread_t thread);
void (*ptr_pthread_exit)(void *retval, char *currentframe);
int (*ptr_pthread_mutex_init)(pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr);
int (*ptr_pthread_mutex_lock)(pthread_mutex_t *mutex);
int (*ptr_pthread_mutex_trylock)(pthread_mutex_t *mutex);
int (*ptr_pthread_mutex_unlock)(pthread_mutex_t *mutex);
int (*ptr_pthread_mutex_destroy)(pthread_mutex_t *mutex);
int (*ptr_pthread_rwlock_init)(pthread_rwlock_t *rwlock,
const pthread_rwlockattr_t *rwlock_attr);
int (*ptr_pthread_rwlock_destroy)(pthread_rwlock_t *rwlock);
int (*ptr_pthread_rwlock_rdlock)(pthread_rwlock_t *rwlock);
int (*ptr_pthread_rwlock_tryrdlock)(pthread_rwlock_t *rwlock);
int (*ptr_pthread_rwlock_wrlock)(pthread_rwlock_t *rwlock);
int (*ptr_pthread_rwlock_trywrlock)(pthread_rwlock_t *rwlock);
int (*ptr_pthread_rwlock_unlock)(pthread_rwlock_t *rwlock);
};
extern void wine_pthread_init_process( const struct wine_pthread_functions *functions );
extern void wine_pthread_init_thread(void);
#endif /* __WINE_WINE_PTHREAD_H */
......@@ -420,6 +420,8 @@ void wine_init( int argc, char *argv[], char *error, int error_size )
void (*init_func)(int, char **);
if (!(ntdll = dlopen_dll( "ntdll.dll", error, error_size, 0, &file_exists ))) return;
/* make sure kernel32 is loaded too */
if (!dlopen_dll( "kernel32.dll", error, error_size, 0, &file_exists )) return;
if (!(init_func = wine_dlsym( ntdll, "__wine_process_init", error, error_size ))) return;
init_func( argc, argv );
}
......
......@@ -117,9 +117,6 @@ static unsigned int server_startticks;
int main_create_flags = 0;
/* scheduler/pthread.c */
extern void PTHREAD_init_done(void);
/* dlls/ntdll/env.c */
extern BOOL init_user_process_pmts( size_t, char*, size_t );
extern BOOL build_command_line( char **argv );
......@@ -359,9 +356,6 @@ static BOOL process_init( char *argv[] )
process_pmts.hStdError = console_handle_map(process_pmts.hStdError);
}
/* Now we can use the pthreads routines */
PTHREAD_init_done();
/* Copy the parent environment */
if (!init_user_process_pmts( info_size, main_exe_name, sizeof(main_exe_name) ))
return FALSE;
......
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