Replace QThread::currentThreadId() by pthread_self()

The handle is used on future pthread operations, so the pthread handle is exactly
what is required here. Using QThread::currentThreadId() is bad as it relies on
internal Qt implementation details for handles, which indeed does break when using
a non-X11 build for Qt (defining Qt handles as void*)