ovs-thread: New module, initially just with pthreads wrapper functions.

The only tricky part here is that I'm throwing in annotations to allow
"sparse" to report unbalanced locking.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
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>