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