Was using the gettid() function directly instead of the _gettid() wrapper.
Partly fixes #1422 (closed)