util: introduce a common interface for setting thread names
authorGarrett Wollman <wollman@csail.mit.edu>
Mon, 11 Jul 2011 10:31:41 +0000 (06:31 -0400)
committerDerrick Brashear <shadow@dementia.org>
Wed, 13 Jul 2011 16:55:22 +0000 (09:55 -0700)
commit8adf4cd0b0ae319b9610cd5caad050f973200ca7
tree038d41421ccae9fb20843d1622bb86561b6d06ac
parent470bab9d564a7be8cdaf808c3d8dda3457821b2f
util: introduce a common interface for setting thread names

A previous change added support for setting thread names/titles to
viced; this change moves the #ifdef spaghetti to src/util in
preparation for calling it from other places where it would be
useful.  Two functions are defined, one for setting an arbitrary
thread's name (as might be done by the spawning thread) and one
for setting the current thread's name; the latter is also defined as
a macro for non-pthreads compilations so that it can be called
unconditionally (the interface does not reference any
pthread-specific data types).  Note that some platforms, Mac OS X
in particular, do not allow setting the name of a different thread.

The two functions are defined as no-ops for Windows as our pthreads
emulation layer for Windows does not provide the needed mechanism.

Make viced use the new interface.

Change-Id: I58c65a28772d8d188c03d6ff3a6f052889362fb7
Reviewed-on: http://gerrit.openafs.org/4966
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
acinclude.m4
src/util/Makefile.in
src/util/afsutil_prototypes.h
src/util/pthread_threadname.c [new file with mode: 0644]
src/viced/viced.c