-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Description
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.
Reactions are currently unavailable