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)
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>

No differences found