Fix setThreadName support for BSD