-
Notifications
You must be signed in to change notification settings - Fork 856
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
[BUG] Accidental introduction of pthread when using std::thread #2951
Comments
This might need a rework : Lines 883 to 884 in 38a3a16
Using should allow a pthread free win32 build |
See the |
Ok, I can see more-less what happened. The |
@Andarwinux could you please check PR #2952? |
Still doesn't seem to solve the problem, unless I add
|
I assume when There are two cases for C++11 then:
Maybe there should be an additional CMake variable and C++ definition indicating the threading library being used 🤔 |
That's not exactly what I have suggested. I have suggested that this should be enabled even if C++11 threads are requested, but only if the C++11 threads implementation is based on POSIX threads. That should be the case on Linux. But in all other cases, the threadname.h should use a stub implementation, REGARDLESS OF AVAILABILITY of pthread_get/setname_np. I also think that it is still safer to turn into stub threadname always if C++11 threads are requested - even on Linux - just reenable it on demand using an extra flag. So, in total 3 things should be conditioned:
And:
|
NOTE: Other platforms besides linux currently use PThreads to set the thread name. For instance Android, MacOS, iOS, various BSDs, Solaris, etc. PR #2952 will break those platforms. |
We are talking about providing the thread names, which is strictly a development feature. It's not a problem then if the thread names are not supported if you requested C++11 threads, and it can be turned back on by an additional option by the developer. |
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
libc++ and libstdc++ support the win32thread implementation of std::thread, in which case the pthread dependency should not be introduced.
Additional context
Although both llvm-mingw and gcc 14 implement std::thread via win32thread, they still support pthread.
This happens because CMake detects pthread support and then threadname.h introduces pthread because
HAVE_PTHREAD_GETNAME_NP
is defined.The text was updated successfully, but these errors were encountered: