Jump to content

COMPILER_FENCE uses deprecated function


Recommended Posts

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 by deleualex
  • Like 1
Link to comment
Share on other sites

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 :) 

  • Like 1
Link to comment
Share on other sites

  • 10 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...