diff options
author | Ludovic Courtès <ludo@gnu.org> | 2009-10-02 16:32:34 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2009-10-09 14:10:05 +0200 |
commit | 705edb959b3093cb1cbe1390110d96ee833b63fc (patch) | |
tree | 2f1157be12074243695c7179ac0be432de6c3527 /acinclude.m4 | |
parent | 46935a1fac58e50276f7e7e49e5fa6bab53c0848 (diff) | |
download | guile-705edb959b3093cb1cbe1390110d96ee833b63fc.tar.gz |
Use TLS when available for `SCM_I_CURRENT_THREAD'.
* acinclude.m4 (GUILE_THREAD_LOCAL_STORAGE): New macro.
* configure.ac: Use it.
* libguile/__scm.h (SCM_THREAD_LOCAL): New macro.
* libguile/gen-scmconfig.c (main): Define `SCM_HAVE_THREAD_STORAGE_CLASS'.
* libguile/gen-scmconfig.h.in (SCM_I_GSC_HAVE_THREAD_STORAGE_CLASS):
New.
* libguile/threads.c
(scm_i_current_thread)[SCM_HAVE_THREAD_STORAGE_CLASS]: New.
(SET_CURRENT_THREAD): New macro.
(guilify_self_1, on_thread_exit, init_thread_key): Use it.
* libguile/threads.h
(scm_i_current_thread)[SCM_HAVE_THREAD_STORAGE_CLASS]: New
declaration.
(SCM_I_CURRENT_THREAD)[SCM_HAVE_THREAD_STORAGE_CLASS]: New macro.
(init_thread_key_once, init_thread_key): Conditionalize on
`!defined SCM_HAVE_THREAD_STORAGE_CLASS'.
(scm_i_init_thread_for_guile): Update accordingly.
Diffstat (limited to 'acinclude.m4')
-rw-r--r-- | acinclude.m4 | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index 1b836ccbd..ed537d0bd 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -335,6 +335,26 @@ AC_DEFUN([GUILE_GNU_LD_RELRO], [ AC_SUBST([GNU_LD_FLAGS]) ]) +dnl GUILE_THREAD_LOCAL_STORAGE +dnl +dnl Check for compiler thread-local storage (TLS) support. +AC_DEFUN([GUILE_THREAD_LOCAL_STORAGE], [ + AC_CACHE_CHECK([whether the `__thread' storage class is available], + [ac_cv_have_thread_storage_class], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([__thread int tls_integer;], + [tls_integer = 123;])], + [ac_cv_have_thread_storage_class="yes"], + [ac_cv_have_thread_storage_class="no"])]) + + if test "x$ac_cv_have_thread_storage_class" = "xyes"; then + SCM_I_GSC_HAVE_THREAD_STORAGE_CLASS=1 + else + SCM_I_GSC_HAVE_THREAD_STORAGE_CLASS=0 + fi + + AC_SUBST([SCM_I_GSC_HAVE_THREAD_STORAGE_CLASS]) +]) + dnl GUILE_READLINE dnl dnl Check all the things needed by `guile-readline', the Readline |