export setThreadName() and add NULL check

Change-Id: I9b69a23b308fe851ed49722c0da3953433b3f5b8