use gettid instead of pthread_self