mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-30 10:33:27 +00:00
@ -9,7 +9,6 @@
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include <arch/x86_64/include/asm/cmpxchg.h>
|
||||
|
||||
#define atomic_read(atomic) ((atomic)->value) // 读取原子变量
|
||||
#define atomic_set(atomic,val) (((atomic)->value) = (val)) // 设置原子变量的初始值
|
||||
@ -98,10 +97,3 @@ inline void atomic_clear_mask(atomic_t *ato, long mask)
|
||||
: "r"(mask)
|
||||
: "memory");
|
||||
}
|
||||
|
||||
// cmpxchgq 比较并交换
|
||||
inline long atomic_cmpxchg(atomic_t *ato, long oldval, long newval)
|
||||
{
|
||||
bool success = arch_try_cmpxchg(&ato->value, &oldval, &newval);
|
||||
return success ? oldval : newval;
|
||||
}
|
Reference in New Issue
Block a user