@@ -148,6 +148,11 @@ reactor Tasks (bank_index:size_t = 0, n_tasks:int = 10, n_pools:int = 1) {
148148 =}
149149
150150 reaction (sch) -> sch, req {=
151+ if (req_itr == n_tasks) {
152+ std::cout << "(" << get_elapsed_logical_time().count() << ", " << get_microstep() << ") physical_time:" << get_elapsed_physical_time().count()
153+ << fqn() << " Tasks queue empty" << std::endl;
154+ return;
155+ }
151156 auto index = *sch.get();
152157 if (index < 0) {
153158 for (int i = 0; i < n_pools; ++i) {
@@ -180,18 +185,20 @@ reactor Tasks (bank_index:size_t = 0, n_tasks:int = 10, n_pools:int = 1) {
180185 reaction (rsp) -> sch {=
181186 for (int i = 0; i < n_pools; ++i) {
182187 if (rsp[i].is_present()) {
188+ std::cout << "(" << get_elapsed_logical_time().count() << ", " << get_microstep() << ") physical_time:" << get_elapsed_physical_time().count()
189+ << "Received response of task:" << *rsp[i].get() << "\n";
183190 ++rsp_itr;
184- if (req_itr < n_tasks) {
185- std::cout << "(" << get_elapsed_logical_time().count() << ", " << get_microstep() << ") physical_time:" << get_elapsed_physical_time().count()
186- << fqn() << " Scheduling task_id:" << req_itr << " to pool:" << i << std::endl;
187- sch.schedule (i, std::chrono::duration_cast<reactor::Duration>(std::chrono::nanoseconds(0)));
188- }
191+ busy[i] = 0;
189192 }
190193 }
191194 if (rsp_itr == n_tasks) {
192195 std::cout << "(" << get_elapsed_logical_time().count() << ", " << get_microstep() << ") physical_time:" << get_elapsed_physical_time().count()
193196 << "Terminating Run\n";
194197 request_stop();
198+ } else {
199+ std::cout << "(" << get_elapsed_logical_time().count() << ", " << get_microstep() << ") physical_time:" << get_elapsed_physical_time().count()
200+ << fqn() << " Scheduling tasks\n";
201+ sch.schedule (-1, std::chrono::duration_cast<reactor::Duration>(std::chrono::nanoseconds(0)));
195202 }
196203 =}
197204
0 commit comments