atomic ptr
This commit is contained in:
parent
04eb118e60
commit
2c3597646d
@ -31,6 +31,9 @@ FORCE_INLINE u64 atomic_u64_eval_add(struct atomic_u64 *x, u64 a) { return _Inte
|
||||
FORCE_INLINE u64 atomic_u64_eval_exchange(struct atomic_u64 *x, u64 e) { return _InterlockedExchange64((volatile i64 *)&x->_v, e); }
|
||||
FORCE_INLINE u64 atomic_u64_eval_compare_exchange(struct atomic_u64 *x, u64 c, u64 e) { return _InterlockedCompareExchange64((volatile i64 *)&x->_v, e, c); }
|
||||
|
||||
FORCE_INLINE void *atomic_ptr_eval(struct atomic_ptr *x) { return (void *)_InterlockedExchangeAdd64((volatile i64 *)&x->_v, 0); }
|
||||
FORCE_INLINE void *atomic_ptr_eval_compare_exchange(struct atomic_ptr *x, void *c, void *e) { return (void *)_InterlockedCompareExchange64((volatile i64 *)&x->_v, (i64)e, (i64)c); }
|
||||
|
||||
#else
|
||||
# error "Atomics not implemented"
|
||||
#endif
|
||||
|
||||
@ -308,6 +308,10 @@ struct atomic_u64 {
|
||||
volatile u64 _v;
|
||||
};
|
||||
|
||||
struct atomic_ptr {
|
||||
volatile void *_v;
|
||||
};
|
||||
|
||||
/* ========================== *
|
||||
* Common structs
|
||||
* ========================== */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user