Changes in uspace/lib/libc/include/atomicdflt.h [228666c:81983e3] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/include/atomicdflt.h
r228666c r81983e3 37 37 38 38 #ifndef LIBC_ARCH_ATOMIC_H_ 39 39 #error This file cannot be included directly, include atomic.h instead. 40 40 #endif 41 41 42 #include <stdint.h>43 42 #include <bool.h> 44 43 45 44 typedef struct atomic { 46 volatile atomic_count_tcount;45 volatile long count; 47 46 } atomic_t; 48 47 49 static inline void atomic_set(atomic_t *val, atomic_count_ti)48 static inline void atomic_set(atomic_t *val, long i) 50 49 { 51 50 val->count = i; 52 51 } 53 52 54 static inline atomic_count_tatomic_get(atomic_t *val)53 static inline long atomic_get(atomic_t *val) 55 54 { 56 55 return val->count; 57 56 } 58 57 59 58 #ifndef CAS 60 static inline bool cas(atomic_t *val, atomic_count_t ov, atomic_count_tnv)59 static inline bool cas(atomic_t *val, long ov, long nv) 61 60 { 62 61 return __sync_bool_compare_and_swap(&val->count, ov, nv);
Note:
See TracChangeset
for help on using the changeset viewer.