annotate src/parallel_execution/AtomicReference.cbc @ 444:0c024ea61601

Using cas interface but occurred warning
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Sun, 26 Nov 2017 04:26:44 +0900
parents 5a737c3df91c
children 8d7e5d48cad3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
441
5a737c3df91c Add AtomicReference Implements of Atomic Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #include "../context.h"
5a737c3df91c Add AtomicReference Implements of Atomic Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
5a737c3df91c Add AtomicReference Implements of Atomic Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 #include <stdio.h>
5a737c3df91c Add AtomicReference Implements of Atomic Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
444
0c024ea61601 Using cas interface but occurred warning
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
5 Atomic* createAtomicReference(struct Context* context) {
441
5a737c3df91c Add AtomicReference Implements of Atomic Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 struct Atomic* atomic = new Atomic();
5a737c3df91c Add AtomicReference Implements of Atomic Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 struct AtomicReference* atomicReference = new AtomicReference();
444
0c024ea61601 Using cas interface but occurred warning
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
8 atomic->atomic = (union Data*)atomicReference;
441
5a737c3df91c Add AtomicReference Implements of Atomic Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 atomic->checkAndSet = C_checkAndSetAtomicReference;
5a737c3df91c Add AtomicReference Implements of Atomic Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 return atomic;
5a737c3df91c Add AtomicReference Implements of Atomic Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 }
5a737c3df91c Add AtomicReference Implements of Atomic Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12
444
0c024ea61601 Using cas interface but occurred warning
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
13 __code checkAndSetAtomicReference(struct AtomicReference* atomic, union Data** ptr, union Data* oldData, union Data* newData, __code next(...), __code fail(...)) {
0c024ea61601 Using cas interface but occurred warning
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
14 if (__sync_bool_compare_and_swap(ptr, oldData, newData)) {
441
5a737c3df91c Add AtomicReference Implements of Atomic Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 goto next(...);
5a737c3df91c Add AtomicReference Implements of Atomic Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 }
5a737c3df91c Add AtomicReference Implements of Atomic Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 goto fail(...);
5a737c3df91c Add AtomicReference Implements of Atomic Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 }