Replies: 31 comments 10 replies
-
Other questions:
|
Beta Was this translation helpful? Give feedback.
-
Oops, sorry, I mistook this repo for MINGW-packages. Please move it there. MSYS2 itself uses Cygwin's pthread library I think? There should be no issue. |
Beta Was this translation helpful? Give feedback.
-
I think this, yes: https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/thread.cc |
Beta Was this translation helpful? Give feedback.
-
It's mostly the latter. Scheduling APIs are fairly easy to implement, as they are just wrappers for Windows APIs, while clock and the semaphore APIs are a bit more complex. The POSIX semaphore can be named or unnamed, so probably we can have
In principle they can. Not sure whether it is a good idea, though, as some Existent programs and libraries that use C++11 threads used to link against winpthreads, so they should continue to work. However, once rebuilt, they shouldn't depend on winpthreads any more. |
Beta Was this translation helpful? Give feedback.
-
ok, I see, I was initially thinking this is a winpthread alternative, but it is a gthread alternative, this my questions didn't make much sense :) Some more questions:
|
Beta Was this translation helpful? Give feedback.
-
No. The only issue that I am aware of is that one may assume
While it may simplify distribution of such supplementary libraries, this library depends on no details about GCC - unlike libssp, libquadmath, etc.; even libstdc++ depends on some GCC builtin functions - and is not to be maintained by GCC developers. I am not denying the possibility though, I am a bit negative whether they will have any interest. |
Beta Was this translation helpful? Give feedback.
-
well from personal experience i can say mcfgthread works very well with gcc :) the only downside im aware of is that it wont work on anything older than Win vista so thats pretty moot. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the feedback. MSYS2 has been |
Beta Was this translation helpful? Give feedback.
-
Might need to clarify |
Beta Was this translation helpful? Give feedback.
-
thats why i ment the point was rather moot ;) |
Beta Was this translation helpful? Give feedback.
-
one strange problem turned up when trying to port gcc to mcfgthread the mcfgthread gcc bootstrap seems to do something odd to __cpuid erroring out because it only detects __cpuid as having 2 variables instead of the 5 needed in libstdc++ random.cc so i cannot build it as is. also theres a strange error with the latest crt complaining about TLS failure, this seems to be due to a recently added patch by martin storsjoe in the mingw-w64 abi. |
Beta Was this translation helpful? Give feedback.
-
May I ask which GCC version you are trying to bootstrap? I have been building GCC 12 for a few months and have not seen issues around mcfgthread can work with the vanilla mingw-w64 CRT or patched CRT (so
|
Beta Was this translation helpful? Give feedback.
-
It looks virtually OK if older versions of Windows are not supported. One more thing: |
Beta Was this translation helpful? Give feedback.
-
The |
Beta Was this translation helpful? Give feedback.
-
I have successfully bootstrapped GCC 12.2.1 (release branch) and observed no issue so far. |
Beta Was this translation helpful? Give feedback.
-
That shouldn't affect the build itself. There may be some other issues. Details explained:
|
Beta Was this translation helpful? Give feedback.
-
no 2 sounds plausible, guess ill have to patch that out while bootstrapping ill try again later. |
Beta Was this translation helpful? Give feedback.
-
gcc-11.3.0 was the version, havent gotten around to rebuilding it yet though. |
Beta Was this translation helpful? Give feedback.
-
Probably you have to update mingw-w64 headers first. |
Beta Was this translation helpful? Give feedback.
-
i did :) |
Beta Was this translation helpful? Give feedback.
-
Did you try bootstrapping mingw-w64-gcc from this repo, without any other patches? As this is the official MSYS2 source, it should build without errors. |
Beta Was this translation helpful? Give feedback.
-
aye and without the mcfgthread patches it builds fine so i was a bit stumped. the problem seems to be in the crt though one error related to tls and one with cpuid. |
Beta Was this translation helpful? Give feedback.
-
ill try reverting to an older mingw-w64-abi to see what happens. |
Beta Was this translation helpful? Give feedback.
-
I'd like to have mcfgthreads upstream. There will be no change for end user, except for independance from winpthreads and increased speed on certain projects. |
Beta Was this translation helpful? Give feedback.
-
@lhmouse thanks for trying to upstream things. https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602704.html |
Beta Was this translation helpful? Give feedback.
-
I have also prepared a patch for mingw-w64 just now: https://sourceforge.net/p/mingw-w64/mailman/message/37717940/ If these two series of patches can be merged I think we can have it after the next GCC release. |
Beta Was this translation helpful? Give feedback.
-
Let me ask a different question: is the mcfgthread LGPL licence a potential problem here? mingw-w64 doesn't use LGPL'd code and for GCC there is the library exception clause. There are projects relying on mingw-w64 on Windows OS and the assumption that mingw-w64 doesn't contanimate their distributions with GPL and/or LGPL. |
Beta Was this translation helpful? Give feedback.
-
I am currently trying to add McfgThread to my project, but it lack documentation, I have no idea how to do it. I am currently unzipping and replacing my file with the binary from https://gcc-mcf.lhmouse.com/ but it doesn't feel like the right way to do it. I am writing here and not in a new issue because it feel like this is the only missing thing from this discussion. Also is it possible to link it statically ? even if there is the static file present, when I compile my program using the archive, at the end my .exe will not run unless I copy / past libmcfgthread-1.dll. |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
So far I've found that mcfgthread supports Vista and newer. |
Beta Was this translation helpful? Give feedback.
-
I am speaking for myself, not for the mingw-w64 project.
Recently, as usual however, there was a report about deadlocks in winpthreads 1. While I believe people are sincere and professional, some of these are not reproducible, and are presumed to have been fixed by a fragile patch 2.
The threading library is so fundamental that, although not being 100% necessary, I think it's time to start replacing winpthreads with something more modern, such as mcfgthread 3.
The pros of winpthreads are:
On the other hand, the pros of mcfgthread are
SRWLOCK
s; winpthreads' condition variable and thread-specific storage access is slow.__cxa_finalize()
as per Itanium ABI.Footnotes
https://sourceforge.net/p/mingw-w64/bugs/774/ ↩
https://github.com/mingw-w64/mingw-w64/commit/330025c54b85512d54b6960fad07498365c8fee3 ↩
https://github.com/lhmouse/mcfgthread ↩
Beta Was this translation helpful? Give feedback.
All reactions