comparison src/parallel_execution/CPUWorker.cbc @ 410:85b0ddbf458e

Fix CudaWorker
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Thu, 14 Sep 2017 02:35:20 +0900
parents 8915fce522b3
children 0eba9a04633f
comparison
equal deleted inserted replaced
409:4d1e3697a6b8 410:85b0ddbf458e
1 #include "../context.h" 1 #include "../context.h"
2 2
3 static void start_worker(Worker* worker); 3 static void startWorker(Worker* worker);
4 4
5 Worker* createCPUWorker(struct Context* context, int id, Queue* queue) { 5 Worker* createCPUWorker(struct Context* context, int id, Queue* queue) {
6 struct Worker* worker = new Worker(); 6 struct Worker* worker = new Worker();
7 struct CPUWorker* cpuWorker = new CPUWorker(); 7 struct CPUWorker* cpuWorker = new CPUWorker();
8 worker->worker = (union Data*)cpuWorker; 8 worker->worker = (union Data*)cpuWorker;
9 worker->tasks = queue; 9 worker->tasks = queue;
10 cpuWorker->id = id; 10 cpuWorker->id = id;
11 worker->taskReceive = C_taskReceiveWorker; 11 worker->taskReceive = C_taskReceiveWorker;
12 worker->shutdown = C_shutdownWorker; 12 worker->shutdown = C_shutdownWorker;
13 pthread_create(&worker->worker->CPUWorker.thread, NULL, (void*)&start_worker, worker); 13 pthread_create(&worker->worker->CPUWorker.thread, NULL, (void*)&startWorker, worker);
14 return worker; 14 return worker;
15 } 15 }
16 16
17 static void start_worker(Worker* worker) { 17 static void startWorker(Worker* worker) {
18 CPUWorker* cpuWorker = (CPUWorker*)worker->worker; 18 CPUWorker* cpuWorker = (CPUWorker*)worker->worker;
19 cpuWorker->context = NEW(struct Context); 19 cpuWorker->context = NEW(struct Context);
20 initContext(cpuWorker->context); 20 initContext(cpuWorker->context);
21 Gearef(cpuWorker->context, Worker)->worker = (union Data*)worker; 21 Gearef(cpuWorker->context, Worker)->worker = (union Data*)worker;
22 goto meta(cpuWorker->context, worker->taskReceive); 22 goto meta(cpuWorker->context, worker->taskReceive);