简体   繁体   中英

Atomic operation functions for Linux 32bit and 64bit?

In Windows, atomic operation functions are separated by 32bit and 64bit like this:

  • InterlockedIncrement32
  • InterlockedIncrement64

Meanwhile, what functions do the same in Linux? What is the function for doing 64-bit variable for __sync_sub_and_fetch ?

__sync_fetch_and_add(adress,value);
__sync_fetch_and_sub(adress,value);

As for my experience, these functions work seamlessly on Linux64_x86

You can find details below

https://gcc.gnu.org/onlinedocs/gcc-4.4.3/gcc/Atomic-Builtins.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM