export setThreadName() and add NULL check