当前位置:首页 > Windows程序 > 正文

Linux下原子性操作,类似Windows下的InterLockedXXX

2021-05-24 Windows程序

type __sync_fetch_and_add (type *ptr, type value);
type __sync_fetch_and_sub (type *ptr, type value);
type __sync_fetch_and_or (type *ptr, type value);
type __sync_fetch_and_and (type *ptr, type value);
type __sync_fetch_and_xor (type *ptr, type value);
type __sync_fetch_and_nand (type *ptr, type value);
type __sync_add_and_fetch (type *ptr, type value);
type __sync_sub_and_fetch (type *ptr, type value);
type __sync_or_and_fetch (type *ptr, type value);
type __sync_and_and_fetch (type *ptr, type value);
type __sync_xor_and_fetch (type *ptr, type value);
type __sync_nand_and_fetch (type *ptr, type value);

参考: 《Multithreaded simple data type access and atomic variables》

Linux下原子性操作,类似Windows下的InterLockedXXX

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/70582.html