Mercurial > hg > Papers > 2021 > anatofuz-master
view paper/src/AtomicTImpl.cbc @ 131:988b3024d685
update
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 08 Feb 2021 05:49:37 +0900 |
parents | 8f0ff6d552ed |
children |
line wrap: on
line source
#include "../context.h" #impl "AtomicT.h" as "AtomicTImpl.h" #include <stdio.h> AtomicT<T> *createAtomicTImpl(struct Context* context, T init){ struct AtomicT<T>* atomicT = new AtomicT(); struct AtomicTImpl<T>* atomicT_impl = new AtomicTImpl(); atomicT->atomicT = (union Data *)atomic_t_impl; ... return atomicT; } __code checkAndSet_AtomicTImpl(struct AtomicTImpl* atomicT_impl, T oldData, T newData, __code next(...), __code fail(...)){ if (__sync_bool_compare_and_swap(&atomicT->atomic, init, newData)){ goto next(...); } goto fail(...); }