fi
AC_DEFINE_UNQUOTED([ENABLE_WINDOWS_WORKAROUNDS], $workarounds, [enable workarounds used on Windows (only useful for test cases)])
+
+# Check if the __thread storage class for thread-local storage is available.
+AC_MSG_CHECKING(whether __thread is supported)
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([#include <stdlib.h>
+ #undef __thread
+ static __thread int a = 1;],
+ [exit(a-1);])],
+ [have_thread_local_gcc=1],[have_thread_local_gcc=0])
+AC_DEFINE_UNQUOTED([HAVE_THREAD_LOCAL_GCC],$have_thread_local_gcc,[Define this if __thread is supported])
+AS_IF([test "x$have_thread_local_gcc" = "x1"],
+ [AC_MSG_RESULT(yes)],
+ [AC_MSG_RESULT(no)])
+
# gcov compilation
AC_MSG_CHECKING(whether to compile with support for code coverage analysis)
AC_ARG_ENABLE([coverage],
* Note that this message maybe truncated to the first BULK_TRACK_SIZE
* characters, in which case it is NOT 0-terminated!
*/
-static char last_bulk[BULK_TRACK_SIZE] __attribute__ ((nonstring));
+static GNUNET_THREAD_LOCAL char last_bulk[BULK_TRACK_SIZE] __attribute__ ((nonstring));
/**
* Type of the last bulk message.
*/
-static enum GNUNET_ErrorType last_bulk_kind;
+static GNUNET_THREAD_LOCAL enum GNUNET_ErrorType last_bulk_kind;
/**
* Time of the last bulk error message (0 for none)
*/
-static struct GNUNET_TIME_Absolute last_bulk_time;
+static GNUNET_THREAD_LOCAL struct GNUNET_TIME_Absolute last_bulk_time;
/**
* Number of times that bulk message has been repeated since.
*/
-static unsigned int last_bulk_repeat;
+static GNUNET_THREAD_LOCAL unsigned int last_bulk_repeat;
/**
* Component when the last bulk was logged. Will be 0-terminated.
*/
-static char last_bulk_comp[COMP_TRACK_SIZE + 1];
+static GNUNET_THREAD_LOCAL char last_bulk_comp[COMP_TRACK_SIZE + 1];
/**
* Running component.
/**
* Number of log calls to ignore.
*/
-static int skip_log = 0;
+static GNUNET_THREAD_LOCAL int skip_log = 0;
/**
* File descriptor to use for "stderr", or NULL for none.