-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getThreadId vs. pthread_self #177
Comments
Hello! Thank you for your suggestion. However,
So, yes, using |
However, on BSD systems, it seems there exists a |
It is not. But if you decide to go the non-portable way, then you should probably use my second patch that uses getthrid(). |
Hi,
On POSIX systems pthread_self() should be used to get the thread ID. This is portable and does not require the hacks currently used inside posixHandler::getThreadId(). To that end, I propose the first attached patch. Note that this is incomplete beacuse
the constants VMIME_HAVE_GETTID, VMIME_HAVE_SYSCALL, VMIME_HAVE_SYSCALL_GETTID have not been removed from the cmake scripts
the getThreadID() unsigned int return type should be changed to uint64_t in order to avoid duplicate IDs through casting. This requires an API change not only in platforms, but also in OpenSSLInitializer::id() which is the only consumer of thread ids that returns unsigned longs instead of unsigned ints (another possible defect). I have not put the effort into this because I do not know if this approach will be accepted.
If you find pthread_self too bold of a move, I am also attaching a second diff that permits vmime to build on OpenBSD continuing the current hackish approach.
Paul
The text was updated successfully, but these errors were encountered: