Mercurial > hg > Gears > GearsAgda
comparison src/parallel_execution/main.c @ 101:8987cf13d5bb
Add Allocate macro
author | innparusu |
---|---|
date | Wed, 02 Mar 2016 19:23:00 +0900 |
parents | 3e28ee215c0e |
children | 64c98838a291 |
comparison
equal
deleted
inserted
replaced
100:3d7ecced7e14 | 101:8987cf13d5bb |
---|---|
256 | 256 |
257 | 257 |
258 int main(int argc, char** argv) { | 258 int main(int argc, char** argv) { |
259 init(argc, argv); | 259 init(argc, argv); |
260 | 260 |
261 array_ptr = (int*)malloc(sizeof(int)*length); | 261 array_ptr = NEWN(length, int); |
262 | 262 |
263 for(int i=0; i<length; i++) | 263 for(int i=0; i<length; i++) |
264 array_ptr[i]=i; | 264 array_ptr[i]=i; |
265 | 265 |
266 struct Context* main_context = (struct Context*)malloc(sizeof(struct Context)); | 266 struct Context* main_context = NEW(struct Context); |
267 initContext(main_context); | 267 initContext(main_context); |
268 main_context->next = CreateData1; | 268 main_context->next = CreateData1; |
269 | 269 |
270 struct Context* worker_contexts = (struct Context*)malloc(sizeof(struct Context)*cpu_num); | 270 struct Context* worker_contexts = NEWN(cpu_num, struct Context); |
271 | 271 |
272 struct Worker* worker = &main_context->data[Worker]->worker; | 272 struct Worker* worker = &main_context->data[Worker]->worker; |
273 worker->num = cpu_num; | 273 worker->num = cpu_num; |
274 worker->contexts = worker_contexts; | 274 worker->contexts = worker_contexts; |
275 | 275 |