112
|
1 #include "../context.h"
|
|
2 #impl "AtomicT.h" as "AtomicTImpl.h"
|
|
3 #include <stdio.h>
|
|
4
|
|
5 AtomicT<T> *createAtomicTImpl(struct Context* context, T init){
|
|
6 struct AtomicT<T>* atomicT = new AtomicT();
|
|
7 struct AtomicTImpl<T>* atomicT_impl = new AtomicTImpl();
|
|
8 atomicT->atomicT = (union Data *)atomic_t_impl;
|
|
9 ...
|
|
10 return atomicT;
|
|
11 }
|
|
12
|
|
13 __code checkAndSet_AtomicTImpl(struct AtomicTImpl* atomicT_impl, T oldData, T newData, __code next(...), __code fail(...)){
|
|
14 if (__sync_bool_compare_and_swap(&atomicT->atomic, init, newData)){
|
|
15 goto next(...);
|
|
16 }
|
|
17 goto fail(...);
|
|
18 }
|
|
19
|