Have anyone tried the meganz mingw-std-threads C++11 std::thread for mingw-w64 win32 for production without issues?

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
tomay3000
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 207
Joined: Mon Apr 24, 2017 4:23 am

Have anyone tried the meganz mingw-std-threads C++11 std::thread for mingw-w64 win32 for production without issues?

Post by tomay3000 »

Hello,

wxWidgets pre-built binaries for mingw-w64 use win32 threading model and sjlj exception handling, and that is for compatibility and also wxWidgets is not using c++11 yet.

This configuration suits me too, but one problem is left, std::thread is not present yet in mingw-w64 win32, though they have said it will be available in the recent releases.

I don't want to use the posix version of mingw-w64 because I don't want the libwinpthread-1.dll alongside with my standalone exe app if it is statically linked with wxWidgets. Because libwinpthread never gets linked statically.

Then I have found this header only library for c++11 missing features in the mingw-w64 win32 model:
https://github.com/meganz/mingw-std-threads

I was wondering if anyone have tried it before, and if it is mature enough to use in production mode.

TIA.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7449
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Have anyone tried the meganz mingw-std-threads C++11 std::thread for mingw-w64 win32 for production without issues?

Post by ONEEYEMAN »

Hi,
While wxWidgets is not using C++11, no one prevents you from using C++11 in your own code. I'm doing that and I don't have any issues.

You will need to compile wxWidgets in C++11 mode. but that''s about it. And it is only to keep the same exact options to the compiler.

Just use std::thread unless you need to maintain an old code.

Other than that - it is encouraged to use std::string, std::thread and all other recent standard features.

Now - some people use/compile both even in C++20 mode.

I hope this answer you question.

Thank you.
Post Reply