[ovs-dev] [threads 02/11] ovs-thread: Add per-thread data support.
blp at nicira.com
Fri Jun 21 00:10:38 UTC 2013
On Thu, Jun 20, 2013 at 07:49:18PM -0400, Ed Maste wrote:
> On 20 June 2013 16:18, Ben Pfaff <blp at 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],
> - [AC_LANG_PROGRAM([static _Thread_local var;], [return var;])],
> + [AC_LANG_PROGRAM(
> + [#include <threads.h>
> + static _Thread_local int var;],
> + [return var;])],
> if test $ovs_cv__Thread_local = no; then
Can you confirm that the autoconf test needs #include <threads.h> but
the actual program doesn't? It looks funny.
More information about the dev