Mercurial > hg > Game > Cerium
comparison example/task_queue/ppe/Hello.cc @ 493:2a7a9f80b8e7 draft
fix free conflict.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 09 Oct 2009 11:29:42 +0900 |
parents | 6b2dda81ea9d |
children | 94d82f2c842f |
comparison
equal
deleted
inserted
replaced
492:6b2dda81ea9d | 493:2a7a9f80b8e7 |
---|---|
18 smanager->printf("[%d] Hello, World!!\n", task_id); | 18 smanager->printf("[%d] Hello, World!!\n", task_id); |
19 | 19 |
20 for(int i=0;i<100;i++) { | 20 for(int i=0;i<100;i++) { |
21 TaskQueueInfo *i0 = q->q[i%MAX_QUEUE]; | 21 TaskQueueInfo *i0 = q->q[i%MAX_QUEUE]; |
22 TaskQueueInfo *i1 = q->q[(i+1)%MAX_QUEUE]; | 22 TaskQueueInfo *i1 = q->q[(i+1)%MAX_QUEUE]; |
23 TaskQueue *q0; | |
24 TaskQueue *q1; | |
23 | 25 |
24 switch(q->m->get_random() % 4) { | 26 switch(q->m->get_random() % 4) { |
25 case 0: | 27 case 0: |
26 TaskQueue *q0 = i0->create(0); | 28 q0 = i0->create(0); |
29 q1 = i1->create(0); | |
27 i1->addLast(q0); | 30 i1->addLast(q0); |
28 TaskQueue *q1 = i1->create(0); | |
29 i0->addLast(q1); | 31 i0->addLast(q1); |
30 break; | 32 break; |
31 case 1: | 33 case 1: |
32 if (TaskQueue *p = i0->poll()) { | 34 if (TaskQueue *p = i0->poll()) { |
33 i1->addLast(p); | 35 i1->addLast(p); |
38 i0->addLast(p); | 40 i0->addLast(p); |
39 } | 41 } |
40 break; | 42 break; |
41 case 3: | 43 case 3: |
42 if (TaskQueue *p = i0->poll()) { | 44 if (TaskQueue *p = i0->poll()) { |
43 i0->free(p); | 45 i0->free_(p); |
44 } | 46 } |
45 if (TaskQueue *p = i1->poll()) { | 47 if (TaskQueue *p = i1->poll()) { |
46 i1->free(p); | 48 i1->free_(p); |
47 } | 49 } |
48 break; | 50 break; |
49 } | 51 } |
50 } | 52 } |
51 | 53 |