Mercurial > hg > Members > kono > Cerium
comparison example/word_count/main.cc @ 1021:f8e9c985e2a8
use MailManager
author | yutaka@localhost.localdomain |
---|---|
date | Sun, 07 Nov 2010 22:10:29 +0900 |
parents | 18a548c337cb |
children | 1e243714cf3c |
comparison
equal
deleted
inserted
replaced
1017:6a2c22cabe10 | 1021:f8e9c985e2a8 |
---|---|
75 } | 75 } |
76 | 76 |
77 static void | 77 static void |
78 run_tasks(SchedTask *manager, WordCount *w, int task_count, HTaskPtr t_next, int size) | 78 run_tasks(SchedTask *manager, WordCount *w, int task_count, HTaskPtr t_next, int size) |
79 { | 79 { |
80 | 80 |
81 if (task_count < array_task_num) { | 81 if (task_count < array_task_num) { |
82 array_task_num = task_count; | 82 array_task_num = task_count; |
83 if (task_count<=0) return; | 83 if (task_count<=0) return; |
84 } | 84 } |
85 | 85 |
170 } | 170 } |
171 | 171 |
172 | 172 |
173 for (int i = 0; i < task_count; i += array_task_num) { | 173 for (int i = 0; i < task_count; i += array_task_num) { |
174 | 174 |
175 HTask *h_exec = 0; | 175 HTask *h_exec = 0; |
176 for (int j = 0; j < array_task_num; j++) { | 176 for (int j = 0; j < array_task_num; j++) { |
177 int i = w->task_spwaned++; | 177 int i = w->task_spwaned++; |
178 if (w->size < size) size = w->size; | 178 if (w->size < size) size = w->size; |
179 if (size==0) break; | 179 if (size==0) break; |
180 | 180 |
181 if (use_compat) { | 181 if (use_compat) { |
182 h_exec = manager->create_task(TASK_EXEC); | 182 h_exec = manager->create_task(TASK_EXEC); |
183 h_exec->set_inData(0,w->file_mmap + i*w->division_size, size); | 183 h_exec->set_inData(0,w->file_mmap + i*w->division_size, size); |
184 h_exec->set_outData(0,w->o_data + i*w->out_size, w->division_out_size); | 184 h_exec->set_outData(0,w->o_data + i*w->out_size, w->division_out_size); |
185 | |
185 | 186 |
186 if (all) { | 187 if (all) { |
187 w->t_print->wait_for(h_exec); | 188 w->t_print->wait_for(h_exec); |
188 } else { | 189 } else { |
189 t_next->wait_for(h_exec); | 190 t_next->wait_for(h_exec); |