comparison dpp.cbc @ 1:2874954d97b2

Fix dpp for cbc using LLVM 3.7
author Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
date Wed, 16 Dec 2015 16:52:16 +0900
parents d4bc23cb728b
children
comparison
equal deleted inserted replaced
0:d4bc23cb728b 1:2874954d97b2
4 ** Note : This is a single running program. 4 ** Note : This is a single running program.
5 */ 5 */
6 6
7 #include "dpp.h" 7 #include "dpp.h"
8 8
9 code putdown_lfork(PhilsPtr self) 9 __code putdown_lfork(PhilsPtr self)
10 { 10 {
11 printf("%d: putdown_lfork:%d\n", self->id, self->left_fork->id); 11 printf("%d: putdown_lfork:%d\n", self->id, self->left_fork->id);
12 self->left_fork->owner = NULL; 12 self->left_fork->owner = NULL;
13 goto thinking(self); 13 goto thinking(self);
14 } 14 }
15 15
16 code putdown_rfork(PhilsPtr self) 16 __code putdown_rfork(PhilsPtr self)
17 { 17 {
18 printf("%d: putdown_rfork:%d\n", self->id, self->right_fork->id); 18 printf("%d: putdown_rfork:%d\n", self->id, self->right_fork->id);
19 self->right_fork->owner = NULL; 19 self->right_fork->owner = NULL;
20 goto putdown_lfork(self); 20 goto putdown_lfork(self);
21 } 21 }
22 22
23 code eating(PhilsPtr self) 23 __code eating(PhilsPtr self)
24 { 24 {
25 printf("%d: eating\n", self->id); 25 printf("%d: eating\n", self->id);
26 goto putdown_rfork(self); 26 goto putdown_rfork(self);
27 } 27 }
28 28
29 /* waiting for right fork */ 29 /* waiting for right fork */
30 code hungry2(PhilsPtr self) 30 __code hungry2(PhilsPtr self)
31 { 31 {
32 printf("%d: hungry2\n", self->id); 32 printf("%d: hungry2\n", self->id);
33 goto pickup_rfork(self); 33 goto pickup_rfork(self);
34 } 34 }
35 35
36 /* waiting for left fork */ 36 /* waiting for left fork */
37 code hungry1(PhilsPtr self) 37 __code hungry1(PhilsPtr self)
38 { 38 {
39 printf("%d: hungry1\n", self->id); 39 printf("%d: hungry1\n", self->id);
40 goto pickup_lfork(self); 40 goto pickup_lfork(self);
41 } 41 }
42 42
43 code pickup_rfork(PhilsPtr self) 43 __code pickup_rfork(PhilsPtr self)
44 { 44 {
45 if (self->right_fork->owner == NULL) { 45 if (self->right_fork->owner == NULL) {
46 printf("%d: pickup_rfork:%d\n", self->id, self->right_fork->id); 46 printf("%d: pickup_rfork:%d\n", self->id, self->right_fork->id);
47 self->right_fork->owner = self; 47 self->right_fork->owner = self;
48 goto eating(self); 48 goto eating(self);
49 } else { 49 } else {
50 goto hungry2(self); 50 goto hungry2(self);
51 } 51 }
52 } 52 }
53 53
54 code pickup_lfork(PhilsPtr self) 54 __code pickup_lfork(PhilsPtr self)
55 { 55 {
56 if (self->left_fork->owner == NULL) { 56 if (self->left_fork->owner == NULL) {
57 printf("%d: pickup_lfork:%d\n", self->id, self->left_fork->id); 57 printf("%d: pickup_lfork:%d\n", self->id, self->left_fork->id);
58 self->left_fork->owner = self; 58 self->left_fork->owner = self;
59 goto pickup_rfork(self); 59 goto pickup_rfork(self);
60 } else { 60 } else {
61 goto hungry1(self); 61 goto hungry1(self);
62 } 62 }
63 } 63 }
64 64
65 code thinking(PhilsPtr self) 65 __code thinking(PhilsPtr self)
66 { 66 {
67 printf("%d: thinking\n", self->id); 67 printf("%d: thinking\n", self->id);
68 goto hungry1(self); 68 goto hungry1(self);
69 } 69 }