On 20 June 2013 16:18, Ben Pfaff <b...@nicira.com> wrote: > On Wed, Jun 19, 2013 at 01:17:03PM -0700, Ben Pfaff wrote: >> POSIX defines a portable pthread_key_t API for per-thread data. GCC and >> C11 have two different forms of per-thread data that are generally faster >> than the POSIX API, where they are available. This commit adds a >> macro-based wrapper, DEFINE_PER_THREAD_DATA, that takes advantage of the >> GCC extension where it is available and falls back to the POSIX API >> otherwise. (I'm not aware of any compilers that implement the C11 feature, >> so this commit doesn't try to use it.) > > Ed Maste pointed out off-list that clang on FreeBSD supports > _Thread_local. Here's a revised version of the patch that supports > both _Thread_local and __thread. I've also updated the "reviews" > branch.
I changed the autoconf test like so: diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4 index 3895346..eb91b1a 100644 --- a/m4/openvswitch.m4 +++ b/m4/openvswitch.m4 @@ -402,7 +402,10 @@ AC_DEFUN([OVS_CHECK__THREAD_LOCAL], [whether $CC supports _Thread_local], [ovs_cv__Thread_local], [AC_LINK_IFELSE( - [AC_LANG_PROGRAM([static _Thread_local var;], [return var;])], + [AC_LANG_PROGRAM( + [#include <threads.h> + static _Thread_local int var;], + [return var;])], [ovs_cv__Thread_local=yes], [ovs_cv__Thread_local=no])]) if test $ovs_cv__Thread_local = no; then This version builds and passes unit tests for me on FreeBSD 9.x, with both GCC and Clang. _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev