According to the POSIX standard returning value of pthread_self() is opaque and can't be casted to long. See NOTES section of pthread_self(3) and pthread_equal(3) man pages.
The code of ThreadImpl::currentOsTidImpl() causes compilation to fail on FreeBSD with
poco/Foundation/src/Thread_POSIX.cpp:326:12: error: cannot initialize return object of type 'long' with an rvalue of type 'pthread_t' (aka 'pthread *')
return ::pthread_self();
^~~~~~~~~~~~~~~~
On the other hand, the method is called currentOsTidImpl and on Linux it calls gettid() syscall. If this method is intended to return kernel thread identifier, then the #else case shouldn't call pthread_self() and instead have #error Implement this for your OS. I'm happy to prepare a pull request if my analysis is right.
According to the POSIX standard returning value of
pthread_self()is opaque and can't be casted tolong. See NOTES section of pthread_self(3) and pthread_equal(3) man pages.The code of
ThreadImpl::currentOsTidImpl()causes compilation to fail on FreeBSD withOn the other hand, the method is called
currentOsTidImpland on Linux it callsgettid()syscall. If this method is intended to return kernel thread identifier, then the#elsecase shouldn't callpthread_self()and instead have#error Implement this for your OS. I'm happy to prepare a pull request if my analysis is right.