diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-09-25 11:40:50 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-09-25 11:40:50 +0300 |
commit | 1d8aebaa096fd5afc758a88f99862e74b5d6c7e0 (patch) | |
tree | 54a8549fdf4087664aeaea27de1b58479205fb2f /intern/atomic/atomic_ops.h | |
parent | 01a3c6b204bfbe149dc2cc2278dd58f206af7ae2 (diff) |
Add an 'atomic cas' wrapper for pointers.
Avoids having to repeat obfuscating castings everywhere...
Diffstat (limited to 'intern/atomic/atomic_ops.h')
-rw-r--r-- | intern/atomic/atomic_ops.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/intern/atomic/atomic_ops.h b/intern/atomic/atomic_ops.h index 72813c39ac2..38670be56fd 100644 --- a/intern/atomic/atomic_ops.h +++ b/intern/atomic/atomic_ops.h @@ -108,6 +108,8 @@ ATOMIC_INLINE unsigned int atomic_fetch_and_add_u(unsigned int *p, unsigned int ATOMIC_INLINE unsigned int atomic_fetch_and_sub_u(unsigned int *p, unsigned int x); ATOMIC_INLINE unsigned int atomic_cas_u(unsigned int *v, unsigned int old, unsigned int _new); +ATOMIC_INLINE void *atomic_cas_ptr(void **v, void *old, void *_new); + /* WARNING! Float 'atomics' are really faked ones, those are actually closer to some kind of spinlock-sync'ed operation, * which means they are only efficient if collisions are highly unlikely (i.e. if probability of two threads * working on the same pointer at the same time is very low). */ |