-
Notifications
You must be signed in to change notification settings - Fork 0
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
win32 threading model #2
Comments
If functional, sure, I can consider it for the next release, 13.3, due soon. |
I took a look at the commit and it seems to cover green threads, which are limited compared to posix threads. Are you sure we want this? |
What do you mean by "green threads"? That term normally refers to threads scheduled by a userspace library, as opposed to threads scheduled by the kernel. But this commit is about kernel threads. It's about reimplementing the win32 model (which maps c11 & c++11 std::thread to win32 threads directly, without requiring the extra winpthreads dependency, and more efficiently), in a better way. Are you perhaps confused by "gthread" ? That "g" stands for "gnu" or "gcc", not "green". |
I confess that I'm a bit confused, and I don't know exactly how to read your suggestion. In the configuration there are several options to configure threads; in GCC there are For cross-platform consistency reasons, up to now I used I did a new build with I'm tempted to update the scripts to use the explicit If you have a better understanding of these issues, please help me with a more detailed suggestion on how to reconfigure the build. |
--enable-libstdcxx-threads has no argument because libstdc++ uses the gthreads abstraction provided by libgcc. --enable-threads=win32|posix selects how that abstraction is implemented in libgcc. "--enable-libstdcxx-threads --enable-threads=win32" should result in emiting C++ std::thread code that does not link with libwinpthread.
Other projects provide two different gcc builds, one for win32, another for posix. That might be more prudent. E.g., Ubuntu has both:
Others at https://www.mingw-w64.org/downloads/ seem to do something like that too. E.g., https://winlibs.com/ provides posix and mfc model toolchains. Unfortunately, the win32 model reimplementation wasn't advertized at https://gcc.gnu.org/gcc-13/changes.html and many seem to have missed it. BTW, I came here because I was searching the web for binary builds of mingw gcc 13 or newer that used the win32 model so that I wouldn't have to build it myself, and what attracted me to this project was fact that you provide both linux and windows binaries, with no need for an installation step on either. I had not heard of xPack before. |
ok
Yeah, but with a larger archive and more build time... :-( Do you know of any disadvantages of configuring the toolchain with the win32 variant? I distribute libwinpthread anyways, so those who prefer POSIX threads I guess they can use them directly, isn't it?
... and macOS.
Please note that there are two packages,
The main use case for However, on Windows, they are more or less equivalent. |
I don't know of a disadvantage. I was just thinking of the potential binary compatibility break (mixing dlls built with posix and win32 models). No idea whether that is important to you or your users.
Yeah, good point. BTW, I opened this bug with gcc, about them not documenting this change anywhere AFAICT: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115105 |
So far, so good, no issues with switching to win32 threads. I published some pre-release binaries: Please give them a try and let me know if they are functional for your projects too. As with any toolchain installed in a custom location, you should either use |
Nice. And GCC 14, perfect!
My projects are just gdb. :-) I tried xpack-mingw-w64-gcc-14.1.0-1-linux-x64.tar.gz to cross build mingw gdb from linux, and it worked nicely. I copied over the resulting gdb to windows and gave it a smoke test, and it starts and worked fine. I am not currently setup to try the native windows build, but that is also a build I will most probably end up using too. Thank you very much for this! |
Hi! Just to let you know that I've now managed to build native Windows GDB using the native Windows toolchain (xpack-mingw-w64-gcc-14.1.0-1-win32-x64.zip from the pre-release dir), successfully. |
Great! It'll take me a few more days to make the final GCC 14.1 release, I'm currently working on the clang releases. |
I saw the GCC that comes with xpack uses the posix threading model. In GCC 13, the GCC win32 threading model implementation was rewritten, and it can now support C++11 std::thread and friends.
See gcc commit 9149a5b7e0a66b7b94d5b7db3194a975d18dea2f, which says:
Are there plans on providing pre-built xpack gcc with the win32 threading model?
The text was updated successfully, but these errors were encountered: