ovs-thread: Make caller provide thread name when creating a thread.
authorBen Pfaff <blp@nicira.com>
Sat, 26 Apr 2014 00:46:21 +0000 (17:46 -0700)
committerBen Pfaff <blp@nicira.com>
Mon, 28 Apr 2014 22:25:49 +0000 (15:25 -0700)
commit8ba0a5227f6e6b50838c157bd303c2d5bf6f4e59
treecefe70017f665e8d9a9c36d7645caa7261fd3dd4
parent595ef8b10ad81c6033df53dfbfdb8c1b01f6de87
ovs-thread: Make caller provide thread name when creating a thread.

Thread names are occasionally very useful for debugging, but from time to
time we've forgotten to set one.  This commit adds the new thread's name
as a parameter to the function to start a thread, to make that mistake
impossible.  This also simplifies code, since two function calls become
only one.

This makes a few other changes to the thread creation function:

    * Since it is no longer a direct wrapper around a pthread function,
      rename it to avoid giving that impression.

    * Remove 'pthread_attr_t *' param that every caller supplied as NULL.

    * Change 'pthread *' parameter into a return value, for convenience.

The system-stats code hadn't set a thread name, so this fixes that issue.

This patch is a prerequisite for making RCU report the name of a thread
that is blocking RCU synchronization, because the easiest way to do that is
for ovsrcu_quiesce_end() to record the current thread's name.
ovsrcu_quiesce_end() is called before the thread function is called, so it
won't get a name set within the thread function itself.  Setting the thread
name earlier, as in this patch, avoids the problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
lib/dpif-netdev.c
lib/netdev-dpdk.c
lib/ovs-rcu.c
lib/ovs-thread.c
lib/ovs-thread.h
ofproto/ofproto-dpif-monitor.c
ofproto/ofproto-dpif-upcall.c
vswitchd/system-stats.c