mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-02 09:16:17 +01:00
Remove support for DCE threads
This commit is contained in:
parent
7d885253fa
commit
715f94e951
25
configure.ac
25
configure.ac
@ -1879,7 +1879,7 @@ dnl *** g_thread checks ***
|
||||
dnl ***********************
|
||||
|
||||
AC_ARG_WITH(threads,
|
||||
[AC_HELP_STRING([--with-threads=@<:@posix/dce/win32@:>@],
|
||||
[AC_HELP_STRING([--with-threads=@<:@posix/win32@:>@],
|
||||
[specify a thread implementation to use])],
|
||||
[if test "x$with_threads" = x; then
|
||||
want_threads=yes
|
||||
@ -1945,12 +1945,6 @@ if test "x$want_threads" = xyes || test "x$want_threads" = xposix \
|
||||
[pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;],
|
||||
have_threads=posix)
|
||||
fi
|
||||
if test "x$have_threads" = xno; then
|
||||
AC_TRY_COMPILE([#include <pthread.h>],
|
||||
[pthread_mutex_t m;
|
||||
pthread_mutex_init (&m, pthread_mutexattr_default);],
|
||||
have_threads=dce)
|
||||
fi
|
||||
# Tru64Unix requires -pthread to find pthread.h. See #103020
|
||||
CPPFLAGS="$CPPFLAGS -pthread"
|
||||
if test "x$have_threads" = xno; then
|
||||
@ -2075,12 +2069,6 @@ if test x"$G_THREAD_CFLAGS" = x; then
|
||||
*-dg-dgux*) # DG/UX
|
||||
G_THREAD_CFLAGS="-D_REENTRANT -D_POSIX4A_DRAFT10_SOURCE"
|
||||
;;
|
||||
*-osf*)
|
||||
# So we are using dce threads. posix threads are already
|
||||
# catched above.
|
||||
G_THREAD_CFLAGS="-threads"
|
||||
G_THREAD_LIBS=$G_THREAD_CFLAGS
|
||||
;;
|
||||
*-sysv5uw7*) # UnixWare 7
|
||||
# We are not using gcc with -pthread. Catched above.
|
||||
G_THREAD_CFLAGS="-Kthread"
|
||||
@ -2125,7 +2113,7 @@ dnl ******************************
|
||||
|
||||
mutex_has_default=no
|
||||
case $have_threads in
|
||||
posix|dce)
|
||||
posix)
|
||||
glib_save_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $GTHREAD_COMPILE_IMPL_DEFINES"
|
||||
if test x"$G_THREAD_LIBS" = x; then
|
||||
@ -2138,7 +2126,7 @@ case $have_threads in
|
||||
*)
|
||||
G_THREAD_LIBS=error
|
||||
glib_save_LIBS="$LIBS"
|
||||
for thread_lib in "" pthread pthread32 pthreads thread dce; do
|
||||
for thread_lib in "" pthread pthread32 pthreads thread; do
|
||||
if test x"$thread_lib" = x; then
|
||||
add_thread_lib=""
|
||||
IN=""
|
||||
@ -2208,12 +2196,7 @@ case $have_threads in
|
||||
mutex_default_type='pthread_mutex_t'
|
||||
mutex_default_init='PTHREAD_MUTEX_INITIALIZER'
|
||||
mutex_header_file='pthread.h'
|
||||
if test "x$have_threads" = "xposix"; then
|
||||
g_threads_impl="POSIX"
|
||||
else
|
||||
g_threads_impl="DCE"
|
||||
have_threads="posix"
|
||||
fi
|
||||
g_threads_impl="POSIX"
|
||||
AC_SUBST(GTHREAD_COMPILE_IMPL_DEFINES)
|
||||
CPPFLAGS="$glib_save_CPPFLAGS"
|
||||
;;
|
||||
|
@ -146,7 +146,7 @@ How to compile GLib itself
|
||||
<para>
|
||||
A thread implementation is needed. The thread support in GLib
|
||||
can be based upon several native thread implementations, e.g.
|
||||
POSIX threads, DCE threads or Solaris threads.
|
||||
POSIX threads, win32 threads or Solaris threads.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
@ -81,21 +81,9 @@ static gboolean posix_check_cmd_prio_warned = FALSE;
|
||||
}G_STMT_END
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
#if defined(G_THREADS_IMPL_POSIX)
|
||||
# define posix_error(what) (what)
|
||||
# define mutexattr_default NULL
|
||||
# define condattr_default NULL
|
||||
#elif defined(G_THREADS_IMPL_DCE)
|
||||
# define posix_error(what) ((what) == -1 ? errno : 0)
|
||||
# define pthread_key_create(a, b) pthread_keycreate (a, b)
|
||||
# define pthread_attr_init(a) pthread_attr_create (a)
|
||||
# define pthread_attr_destroy(a) pthread_attr_delete (a)
|
||||
# define pthread_create(a, b, c, d) pthread_create (a, *b, c, d)
|
||||
# define mutexattr_default (pthread_mutexattr_default)
|
||||
# define condattr_default (pthread_condattr_default)
|
||||
#else /* neither G_THREADS_IMPL_POSIX nor G_THREADS_IMPL_DCE are defined */
|
||||
# error This should not happen. Contact the GLib team.
|
||||
#endif
|
||||
#define posix_error(what) (what)
|
||||
#define mutexattr_default NULL
|
||||
#define condattr_default NULL
|
||||
|
||||
#if defined (POSIX_MIN_PRIORITY) && defined (POSIX_MAX_PRIORITY)
|
||||
# define HAVE_PRIORITIES 1
|
||||
@ -128,18 +116,12 @@ g_thread_impl_init(void)
|
||||
g_thread_min_stack_size = MAX (sysconf (_SC_THREAD_STACK_MIN), 0);
|
||||
#endif /* _SC_THREAD_STACK_MIN */
|
||||
#ifdef HAVE_PRIORITIES
|
||||
# ifdef G_THREADS_IMPL_POSIX
|
||||
{
|
||||
struct sched_param sched;
|
||||
int policy;
|
||||
posix_check_cmd (pthread_getschedparam (pthread_self(), &policy, &sched));
|
||||
priority_normal_value = sched.sched_priority;
|
||||
}
|
||||
# else /* G_THREADS_IMPL_DCE */
|
||||
posix_check_cmd (priority_normal_value =
|
||||
pthread_getprio (*(pthread_t*)thread,
|
||||
g_thread_priority_map [priority]));
|
||||
# endif
|
||||
#endif /* HAVE_PRIORITIES */
|
||||
}
|
||||
#endif /* _SC_THREAD_STACK_MIN || HAVE_PRIORITIES */
|
||||
@ -174,13 +156,8 @@ g_mutex_trylock_posix_impl (GMutex * mutex)
|
||||
|
||||
result = pthread_mutex_trylock ((pthread_mutex_t *) mutex);
|
||||
|
||||
#ifdef G_THREADS_IMPL_POSIX
|
||||
if (result == EBUSY)
|
||||
return FALSE;
|
||||
#else /* G_THREADS_IMPL_DCE */
|
||||
if (result == 0)
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
posix_check_err (posix_error (result), "pthread_mutex_trylock");
|
||||
return TRUE;
|
||||
@ -230,11 +207,7 @@ g_cond_timed_wait_posix_impl (GCond * cond,
|
||||
result = pthread_cond_timedwait ((pthread_cond_t *) cond,
|
||||
(pthread_mutex_t *) entered_mutex,
|
||||
&end_time);
|
||||
#ifdef G_THREADS_IMPL_POSIX
|
||||
timed_out = (result == ETIMEDOUT);
|
||||
#else /* G_THREADS_IMPL_DCE */
|
||||
timed_out = (result == -1) && (errno == EAGAIN);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!timed_out)
|
||||
@ -274,16 +247,8 @@ g_private_get_posix_impl (GPrivate * private_key)
|
||||
{
|
||||
if (!private_key)
|
||||
return NULL;
|
||||
#ifdef G_THREADS_IMPL_POSIX
|
||||
|
||||
return pthread_getspecific (*(pthread_key_t *) private_key);
|
||||
#else /* G_THREADS_IMPL_DCE */
|
||||
{
|
||||
void* data;
|
||||
posix_check_cmd (pthread_getspecific (*(pthread_key_t *) private_key,
|
||||
&data));
|
||||
return data;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@ -322,23 +287,16 @@ g_thread_create_posix_impl (GThreadFunc thread_func,
|
||||
pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM);
|
||||
#endif /* PTHREAD_SCOPE_SYSTEM */
|
||||
|
||||
#ifdef G_THREADS_IMPL_POSIX
|
||||
posix_check_cmd (pthread_attr_setdetachstate (&attr,
|
||||
joinable ? PTHREAD_CREATE_JOINABLE : PTHREAD_CREATE_DETACHED));
|
||||
#endif /* G_THREADS_IMPL_POSIX */
|
||||
|
||||
#ifdef HAVE_PRIORITIES
|
||||
# ifdef G_THREADS_IMPL_POSIX
|
||||
{
|
||||
struct sched_param sched;
|
||||
posix_check_cmd (pthread_attr_getschedparam (&attr, &sched));
|
||||
sched.sched_priority = g_thread_priority_map [priority];
|
||||
posix_check_cmd_prio (pthread_attr_setschedparam (&attr, &sched));
|
||||
}
|
||||
# else /* G_THREADS_IMPL_DCE */
|
||||
posix_check_cmd_prio
|
||||
(pthread_attr_setprio (&attr, g_thread_priority_map [priority]));
|
||||
# endif /* G_THREADS_IMPL_DCE */
|
||||
#endif /* HAVE_PRIORITIES */
|
||||
ret = posix_error (pthread_create (thread, &attr,
|
||||
(void* (*)(void*))thread_func, arg));
|
||||
@ -353,11 +311,6 @@ g_thread_create_posix_impl (GThreadFunc thread_func,
|
||||
}
|
||||
|
||||
posix_check_err (ret, "pthread_create");
|
||||
|
||||
#ifdef G_THREADS_IMPL_DCE
|
||||
if (!joinable)
|
||||
posix_check_cmd (pthread_detach (thread));
|
||||
#endif /* G_THREADS_IMPL_DCE */
|
||||
}
|
||||
|
||||
static void
|
||||
@ -385,7 +338,6 @@ g_thread_set_priority_posix_impl (gpointer thread, GThreadPriority priority)
|
||||
g_return_if_fail (priority >= G_THREAD_PRIORITY_LOW);
|
||||
g_return_if_fail (priority <= G_THREAD_PRIORITY_URGENT);
|
||||
#ifdef HAVE_PRIORITIES
|
||||
# ifdef G_THREADS_IMPL_POSIX
|
||||
{
|
||||
struct sched_param sched;
|
||||
int policy;
|
||||
@ -395,10 +347,6 @@ g_thread_set_priority_posix_impl (gpointer thread, GThreadPriority priority)
|
||||
posix_check_cmd_prio (pthread_setschedparam (*(pthread_t*)thread, policy,
|
||||
&sched));
|
||||
}
|
||||
# else /* G_THREADS_IMPL_DCE */
|
||||
posix_check_cmd_prio (pthread_setprio (*(pthread_t*)thread,
|
||||
g_thread_priority_map [priority]));
|
||||
# endif
|
||||
#endif /* HAVE_PRIORITIES */
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user