folly: improve setThreadName for macOS
authorWez Furlong <wez@fb.com>
Mon, 18 Jul 2016 23:33:31 +0000 (16:33 -0700)
committerFacebook Github Bot 7 <facebook-github-bot-7-bot@fb.com>
Mon, 18 Jul 2016 23:38:29 +0000 (16:38 -0700)
commitcf21fddda97b2bd137154213e1b49e02d9576788
tree36bd34668eb3ed34e78c64e25f2278e6f392715e
parent46763a64f652c6218d253fb4307a9722587187e2
folly: improve setThreadName for macOS

Summary:
Since OS X 10.6 it is possible to set the name of the current thread.
This diff adjusts our setThreadName routine to do this, partially fixing
the associated test case.  Even though this doesn't completely cover
all cases it is still a valid improvement: most callers are
threads setting their own name.

I've amended the tests so that they can accomodate systems that cannot
set the names of other threads.

Reviewed By: yfeldblum

Differential Revision: D3576281

fbshipit-source-id: 13caf0dca6496aa2da897631e8d7327a6ee452bb
folly/ThreadName.h
folly/test/ThreadNameTest.cpp