Closed MDMS24 closed 5 months ago
My two cents: If you have version 14.40.33810 installed on your PC, you won't encounter any issues. It's good practice to always verify that the runtime used to build the application is available on the target PC. If it is not installed, the installer should ensure its installation.
@bshoshany if you add #define _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR please made it optionnal.
Well, we use BS_thread_pool.hpp in a software product and so we can’t control which runtime a user might have installed nor other software that might manipulate which runtimes are installed.
Also, seems that Windows 11 removes the older runtimes now as a default behavior. But now that we understand the issue, sure, our software could check the runtime version, I suppose. But we would prefer to address this problem more directly.
From: Allan CORNET @.> Sent: Sunday, June 9, 2024 5:47 PM To: bshoshany/thread-pool @.> Cc: MDMS24 @.>; Author @.> Subject: Re: [bshoshany/thread-pool] [BUG] new Microsoft Visual C++ 2015-2022 Redistributable requires #define _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR (Issue #151)
My two cents: If you have version 14.40.33810 installed on your PC, you won't encounter any issues. It's good practice to always verify that the runtime used to build the application is available on the target PC. If it is not installed, the installer should ensure its installation.
@bshoshany https://github.com/bshoshany if you add #define _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR please made it optionnal.
— Reply to this email directly, view it on GitHub https://github.com/bshoshany/thread-pool/issues/151#issuecomment-2156661441, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXMMXJIHM7F3L7JOAKXULTTZGR2FVAVCNFSM6AAAAABJA7MRU2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJWGY3DCNBUGE . You are receiving this because you authored the thread.Message ID: < @.***>
The point isn't to debate this here, but if you don't check the runtime, how can you be sure that your software works with your build on all platforms ?
It's not the responsibility of the libraries to handle this issue, but rather your Visual Studio configuration.
#ifdef _MSC_VER < 1940
#define _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR
#endif
#include <BS_thread_pool.hpp>
You can also add this directive directly in your Visual Studio configuration.
Discussion of M$ available here: https://developercommunity.visualstudio.com/t/Access-violation-with-std::mutex::lock-a/10664660#T-ND10678728
Hi @MDMS24 and thanks for the bug report! Sorry for the late reply, I'm having a very busy week.
On my PC I currently have Visual Studio 2022 v17.10.2 with Microsoft Visual C++ 2015-2022 Redistributable v14.40.33810. However, my test program (BS_thread_pool_test.cpp
) finishes all the tests successfully without crashing when compiled with MSVC.
Are you able to provide a minimal working example that demonstrates the crash you are encountering, so I can reproduce it on my end?
Been using thread_pool.hpp version 2.0.0, building executables using MSVS 2022 with platform toolset v143. With the following installed on Windows 11, both the old thread_pool.hpp version 2.0.0 and the new BS_thread_pool.hpp version 4.1.0 work as expected. (We updated to BS_thread_pool.hpp version 4.1.0 to get your support.)
But with the most recent MSVS 2022 update (from VS 2022 17.9 to VS 2022 17.10), the above redistributables are also updated as follows:
And with the above-listed 14.40.33810 redistributables, our software running thread_pool.hpp version 2.0.0 and the new BS_thread_pool.hpp version 4.1.0 crashes. Crash happens on all Windows 11 computers (various hardware, various software configurations) that we've tried.
The aforementioned crash happens on the line attempting to declare a pool of threads: BS::thread_pool pool; *** Executing the above line is causing the crash.
Digging into the "VS 2022 17.10" changelog on Github: https://github.com/microsoft/STL/wiki/Changelog#vs-2022-1710
As indicated above, my workaround to use BS_thread_pool.hpp with the newest MSVS 2022 update is to put:
define _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR
as the very first line in the file BS_thread_pool.hpp
Can you recommend and/or implement are more correct fix that allows mutex to be of type constexpr ?
Thanks in advance,
Manfred Sever.