ovs-thread: New function xpthread_setspecific().

Signed-off-by: Ben Pfaff <blp@nicira.com>
ovs-thread: Add support for globally visible per-thread data.

DEFINE_PER_THREAD_DATA always declared its data item as "static", meaning
that it was only directly visible within a single translation unit.
This commit adds additional forms of per-thread data that allow the data
to be accessible from multiple translation units.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ovs-thread: New function ovsthread_id_self().

I foresee a need for possibly large numbers of instances of "struct
seq" (which is introduced in an upcoming patch).  Each struct seq
needs some per-thread data.  POSIX has pthread_key_t for this, but
the number of keys can be fairly limited, to as few as 128.  It is
reasonable to work around this by using a hash table indexed on the
current thread.  That only works if one can get a thread identifier
that is hashable (pthread_t is not).  This patch introduces a
hashable thread identifier.

Signed-off-by: Ben Pfaff <blp@nicira.com>
seq: New module for race-free, pollable, thread-safe sequence number.

Signed-off-by: Ben Pfaff <blp@nicira.com>
dpif-netdev: Avoid races on queue and port changes using seq objects.

Signed-off-by: Ben Pfaff <blp@nicira.com>