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...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...