diff --git a/configure.ac b/configure.ac index a254634b5..e5b83798a 100644 --- a/configure.ac +++ b/configure.ac @@ -1238,7 +1238,7 @@ save_LIBS="$LIBS" LIBS="$BDW_GC_LIBS $LIBS" CFLAGS="$BDW_GC_CFLAGS $CFLAGS" -AC_CHECK_FUNCS([GC_do_blocking GC_call_with_gc_active]) +AC_CHECK_FUNCS([GC_do_blocking GC_call_with_gc_active GC_pthread_exit GC_pthread_cancel]) # Though the `GC_do_blocking ()' symbol is present in GC 7.1, it is not # declared, and has a different type (returning void instead of diff --git a/libguile/gen-scmconfig.c b/libguile/gen-scmconfig.c index 02633563d..97066b78e 100644 --- a/libguile/gen-scmconfig.c +++ b/libguile/gen-scmconfig.c @@ -318,6 +318,18 @@ main (int argc, char *argv[]) pf ("#define SCM_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER %d /* 0 or 1 */\n", SCM_I_GSC_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER); +#ifdef HAVE_GC_PTHREAD_CANCEL + pf ("#define SCM_HAVE_GC_PTHREAD_CANCEL 1 /* 0 or 1 */\n"); +#else + pf ("#define SCM_HAVE_GC_PTHREAD_CANCEL 0 /* 0 or 1 */\n"); +#endif + +#ifdef HAVE_GC_PTHREAD_EXIT + pf ("#define SCM_HAVE_GC_PTHREAD_EXIT 1 /* 0 or 1 */\n"); +#else + pf ("#define SCM_HAVE_GC_PTHREAD_EXIT 0 /* 0 or 1 */\n"); +#endif + pf ("\n\n/*** File system access ***/\n"); pf ("/* Define to 1 if `struct dirent64' is available. */\n"); diff --git a/libguile/pthread-threads.h b/libguile/pthread-threads.h index c180af252..b5fff834d 100644 --- a/libguile/pthread-threads.h +++ b/libguile/pthread-threads.h @@ -38,8 +38,19 @@ #define scm_i_pthread_self pthread_self #define scm_i_pthread_create GC_pthread_create #define scm_i_pthread_detach GC_pthread_detach + +#if SCM_HAVE_GC_PTHREAD_EXIT #define scm_i_pthread_exit GC_pthread_exit +#else +#define scm_i_pthread_exit pthread_exit +#endif + +#if SCM_HAVE_GC_PTHREAD_CANCEL #define scm_i_pthread_cancel GC_pthread_cancel +#else +#define scm_i_pthread_cancel pthread_cancel +#endif + #define scm_i_pthread_cleanup_push pthread_cleanup_push #define scm_i_pthread_cleanup_pop pthread_cleanup_pop #define scm_i_sched_yield sched_yield