mirror_lxc/config/tls.m4
S.Çağlar Onur babbea4b30 check pthread_atfork and thread-local storage
Add pthread_atfork check to configure.ac and uses it when necessary,
Introduces tls.m4 macro for checking thread-local storage support, Puts
values array into thread-local storage
(lxc_global_config_value@src/lxc/utils.c), Removes
static_lock/static_unlock from LXC code.

Lastly, it introduces a warning for bionic users about multithreaded
usage of LXC.

(requires 64b1be2903 to be reverted first)

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-06 09:46:32 -05:00

15 lines
709 B
Plaintext

# See if we have working TLS. We only check to see if it compiles, and that
# the resulting program actually runs, not whether the resulting TLS variables
# work properly; that check is done at runtime, since we can run binaries
# compiled with __thread on systems without TLS.
AC_DEFUN([LXC_CHECK_TLS],
[
AC_MSG_CHECKING(for TLS)
AC_RUN_IFELSE([AC_LANG_SOURCE([[ static __thread int val; int main() { return 0; } ]])],[have_tls=yes],[have_tls=no],[have_tls=no ])
AC_MSG_RESULT($have_tls)
if test "$have_tls" = "yes"; then
AC_DEFINE([HAVE_TLS],[1],[Define if the compiler supports __thread])
AC_DEFINE([thread_local],[__thread],[Define to the compiler TLS keyword])
fi
])