Line | |
---|
1 | #ifndef __ARCH_I386_ATOMIC__
|
---|
2 | #define __ARCH_I386_ATOMIC__
|
---|
3 |
|
---|
4 | #define LOCK
|
---|
5 |
|
---|
6 | typedef struct { int counter; } atomic_t;
|
---|
7 |
|
---|
8 | #define ATOMIC_INIT(i) { (i) }
|
---|
9 |
|
---|
10 | #define atomic_read(v) ((v)->counter)
|
---|
11 | #define atomic_set(v,i) (((v)->counter) = (i))
|
---|
12 |
|
---|
13 | void atomic_add(int i, volatile atomic_t *v);
|
---|
14 | void atomic_sub(int i, volatile atomic_t *v);
|
---|
15 |
|
---|
16 | void atomic_inc(volatile atomic_t *v);
|
---|
17 | #pragma aux atomic_inc = \
|
---|
18 | "lock inc dword ptr [eax]" \
|
---|
19 | parm [eax];
|
---|
20 |
|
---|
21 | void atomic_dec(volatile atomic_t *v);
|
---|
22 | #pragma aux atomic_dec = \
|
---|
23 | "lock dec dword ptr [eax]" \
|
---|
24 | parm [eax];
|
---|
25 |
|
---|
26 | int atomic_dec_and_test(volatile atomic_t *v);
|
---|
27 | extern int atomic_add_negative(int i, volatile atomic_t *v);
|
---|
28 |
|
---|
29 | /* These are x86-specific, used by some header files */
|
---|
30 | #define atomic_clear_mask(mask, addr)
|
---|
31 |
|
---|
32 | #define atomic_set_mask(mask, addr)
|
---|
33 |
|
---|
34 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.