Mercurial > hg > GearsTemplate
view src/AtomicReference.cbc @ 590:9146d6017f18 default tip
hg mv parallel_execution/* ..
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 16 Jan 2020 15:12:06 +0900 |
parents | src/parallel_execution/AtomicReference.cbc@ac244346c85d |
children |
line wrap: on
line source
#include "../context.h" #interface "Atomic.h" #include <stdio.h> Atomic* createAtomicReference(struct Context* context) { struct Atomic* atomic = new Atomic(); struct AtomicReference* atomicReference = new AtomicReference(); atomic->atomic = (union Data*)atomicReference; atomic->checkAndSet = C_checkAndSetAtomicReference; return atomic; } __code checkAndSetAtomicReference(struct AtomicReference* atomic, union Data** ptr, union Data* oldData, union Data* newData, __code next(...), __code fail(...)) { if (__sync_bool_compare_and_swap(ptr, oldData, newData)) { goto next(...); } goto fail(...); }