ovs-thread: Add per-thread data support.
authorBen Pfaff <blp@nicira.com>
Tue, 25 Jun 2013 20:50:26 +0000 (13:50 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 25 Jun 2013 21:05:01 +0000 (14:05 -0700)
commitc22095a5fb199723cbccc7156cc345260fe99731
treee9b3a91f947526f200c46b215c7c18149b609597
parentec68790f6d522aae2a3d5d97f1974915a76e23cf
ovs-thread: Add per-thread data support.

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 these
features where they are available and falls back to the POSIX API
otherwise.

The Clang compiler implements C11 thread_local in its <threads.h>.

This commit also adds a convenience wrapper for the POSIX API, via the
DEFINE_PER_THREAD_MALLOCED_DATA macro.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
configure.ac
lib/ovs-thread.h
m4/openvswitch.m4