fix crash in pthread_testcancel if pthread_self has not been called