Subversion Repositories HelenOS

Rev

Rev 2287 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2287 Rev 2313
Line 35... Line 35...
35
#ifndef LIBC_arm32_ATOMIC_H_
35
#ifndef LIBC_arm32_ATOMIC_H_
36
#define LIBC_arm32_ATOMIC_H_
36
#define LIBC_arm32_ATOMIC_H_
37
 
37
 
38
/** Atomic addition.
38
/** Atomic addition.
39
 *
39
 *
40
 * @param val Atomic value.
40
 * @param val "Atomic variable".
41
 * @param i Value to add.
41
 * @param i Value to add.
42
 *
42
 *
43
 * @return Value after addition.
43
 * @return Value after addition.
44
 */
44
 */
45
static inline long atomic_add(atomic_t *val, int i)
45
static inline long atomic_add(atomic_t *val, int i)
Line 65... Line 65...
65
}
65
}
66
 
66
 
67
static inline void atomic_inc(atomic_t *val) { atomic_add(val, 1); }
67
static inline void atomic_inc(atomic_t *val) { atomic_add(val, 1); }
68
static inline void atomic_dec(atomic_t *val) { atomic_add(val, -1); }
68
static inline void atomic_dec(atomic_t *val) { atomic_add(val, -1); }
69
 
69
 
70
static inline long atomic_preinc(atomic_t *val) { return atomic_add(val, 1) + 1; }
70
static inline long atomic_preinc(atomic_t *val) { return atomic_add(val, 1); }
71
static inline long atomic_predec(atomic_t *val) { return atomic_add(val, -1) - 1; }
71
static inline long atomic_predec(atomic_t *val) { return atomic_add(val, -1); }
72
 
72
 
73
static inline long atomic_postinc(atomic_t *val) { return atomic_add(val, 1); }
73
static inline long atomic_postinc(atomic_t *val) { return atomic_add(val, 1) - 1; }
74
static inline long atomic_postdec(atomic_t *val) { return atomic_add(val, -1); }
74
static inline long atomic_postdec(atomic_t *val) { return atomic_add(val, -1) + 1; }
75
 
75
 
76
#endif
76
#endif
77
 
77
 
78
/** @}
78
/** @}
79
 */
79
 */