ovs-thread: New function ovsthread_id_self().
authorBen Pfaff <blp@nicira.com>
Tue, 6 Aug 2013 21:57:19 +0000 (14:57 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 8 Aug 2013 20:18:10 +0000 (13:18 -0700)
commit6878fada586a8ed5f45a50f9c8834dcf06bdc1f5
treea716be3e6527287cf0e80b615104cbc9be95deb1
parent2ba4f163d9ea84aa8b8e9d8678371a70af766b5e
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>
lib/ovs-thread.c
lib/ovs-thread.h