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