Switched to use gettid system call for Linux.