Changeset 8d04f709 in mainline
- Timestamp:
- 2009-12-02T23:26:20Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 84b14e2
- Parents:
- e15e0e8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/arch/arm32/include/atomic.h
re15e0e8 r8d04f709 37 37 #define LIBC_arm32_ATOMIC_H_ 38 38 39 #include <bool.h> 40 41 typedef struct atomic { 42 volatile long count; 43 } atomic_t; 44 45 static inline void atomic_set(atomic_t *val, long i) 46 { 47 val->count = i; 48 } 49 50 static inline long atomic_get(atomic_t *val) 51 { 52 return val->count; 53 } 54 55 static inline bool cas(atomic_t *val, long ov, long nv) 56 { 57 /* FIXME: is not atomic */ 58 if (val->count == ov) { 59 val->count = nv; 60 return true; 61 } 62 return false; 63 } 64 39 65 /** Atomic addition. 40 66 * … … 49 75 volatile long * mem = &(val->count); 50 76 77 /* FIXME: is not atomic, is broken */ 51 78 asm volatile ( 52 79 "1:\n"
Note:
See TracChangeset
for help on using the changeset viewer.