deleualex Posted February 7, 2022 Report Share Posted February 7, 2022 (edited) Hi All! I'm relatively new to the project and just started to get familiar with the code. It's a great way to keep in shape. I just have one curiosity: I see in the code in several places this COMPILER_FENCE macro that uses the deprecated intrinsic function "ReadWriteBarrier". According to MS Docs: The _ReadBarrier, _WriteBarrier, and _ReadWriteBarrier compiler intrinsics and the MemoryBarrier macro are all deprecated and should not be used. For inter-thread communication, use mechanisms such as atomic_thread_fence and std::atomic<T>, which are defined in the C++ Standard Library. For hardware access, use the /volatile:iso compiler option together with the volatile keyword. Do you guys see any risk in continuing to use this? It's used quite often in the code, and it's a quite sensitive matter I recon (memory and compiler optimization). Thanks, Alex Edited February 7, 2022 by deleualex 1 Quote Link to comment Share on other sites More sharing options...
Stan` Posted February 7, 2022 Report Share Posted February 7, 2022 Hey @deleualex Welcome to the forums, and thanks for your interest in 0 A.D. programming! We carry a lot of old code in the engine, and this is no exception. It would be nice to replace them, there is quite a few things to thread or that should make use of the threadpool. So if you want to make a patch go ahead Feel free to get in touch with @wraitii and @vladislavbelov as they have more knowledge 1 Quote Link to comment Share on other sites More sharing options...
phosit Posted December 28, 2022 Report Share Posted December 28, 2022 (edited) I made a patch which does remove `COMPILER_FENCE` in some places: D4790 Edited December 28, 2022 by phosit Quote Link to comment Share on other sites More sharing options...
vladislavbelov Posted December 28, 2022 Report Share Posted December 28, 2022 18 minutes ago, phosit said: I made a patch which does remove `COMPILER_FENCE` in some places: D4790 There is a patch by deleualex already: D4487. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.