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
[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
*-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"
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
*)
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=""
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"
;;
}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
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 */
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;
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)
{
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
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));
}
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
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;
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 */
}