Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternatives to GCC's new atomic integer operations

GCC's recent support for atomic operations (as described here) is great, and is 90% of what we need. Unfortunately, some of our products still need to run on Windows and so we need atomic integer operations for Windows as well.

In the past, we had custom assembly language implementations for all our platforms, but I'd like move all the *nix platforms over to the GCC supported operations and the thought crossed my mind that perhaps there is also a more standard way to do this on Windows now as well...

Is there an officially sanctioned way of doing this on Windows (other than implementing them yourself in assembly language)?

like image 369
dicroce Avatar asked Oct 27 '09 19:10

dicroce


1 Answers

You want the Interlocked functions.

like image 194
i_am_jorf Avatar answered Nov 11 '22 06:11

i_am_jorf