summaryrefslogtreecommitdiff
path: root/ufo/ufo-scheduler.c
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2015-05-28 15:19:49 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2015-05-28 15:19:49 +0200
commitce21698cdb187ed71cb3e23c70923fab9bccc6a2 (patch)
treee21877c93066203d35cf5eeebc91e05e8e4751ca /ufo/ufo-scheduler.c
parent039295de2c66e1cc91c4aff8f988abd26008efb6 (diff)
Allow reductors to pause processing
Diffstat (limited to 'ufo/ufo-scheduler.c')
-rw-r--r--ufo/ufo-scheduler.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/ufo/ufo-scheduler.c b/ufo/ufo-scheduler.c
index 8d86524..317724c 100644
--- a/ufo/ufo-scheduler.c
+++ b/ufo/ufo-scheduler.c
@@ -279,13 +279,30 @@ run_task (TaskLocalData *tld)
case UFO_TASK_MODE_REDUCTOR:
do {
- ufo_profiler_trace_event (profiler, UFO_TRACE_EVENT_PROCESS | UFO_TRACE_EVENT_BEGIN);
- ufo_task_process (tld->task, inputs, output, &requisition);
- ufo_profiler_trace_event (profiler, UFO_TRACE_EVENT_PROCESS | UFO_TRACE_EVENT_END);
-
- release_inputs (tld, inputs);
- active = get_inputs (tld, inputs);
+ gboolean go_on = TRUE;
+
+ do {
+ ufo_profiler_trace_event (profiler, UFO_TRACE_EVENT_PROCESS | UFO_TRACE_EVENT_BEGIN);
+ go_on = ufo_task_process (tld->task, inputs, output, &requisition);
+ ufo_profiler_trace_event (profiler, UFO_TRACE_EVENT_PROCESS | UFO_TRACE_EVENT_END);
+
+ release_inputs (tld, inputs);
+ active = get_inputs (tld, inputs);
+ go_on = go_on && active;
+ } while (go_on);
+
+ do {
+ ufo_profiler_trace_event (profiler, UFO_TRACE_EVENT_GENERATE | UFO_TRACE_EVENT_BEGIN);
+ go_on = ufo_task_generate (tld->task, output, &requisition);
+ ufo_profiler_trace_event (profiler, UFO_TRACE_EVENT_GENERATE | UFO_TRACE_EVENT_END);
+
+ if (go_on) {
+ ufo_group_push_output_buffer (group, output);
+ output = ufo_group_pop_output_buffer (group, &requisition);
+ }
+ } while (go_on);
} while (active);
+
break;
case UFO_TASK_MODE_GENERATOR:
@@ -305,19 +322,6 @@ run_task (TaskLocalData *tld)
if (active)
release_inputs (tld, inputs);
- if (mode == UFO_TASK_MODE_REDUCTOR) {
- do {
- ufo_profiler_trace_event (profiler, UFO_TRACE_EVENT_GENERATE | UFO_TRACE_EVENT_BEGIN);
- active = ufo_task_generate (tld->task, output, &requisition);
- ufo_profiler_trace_event (profiler, UFO_TRACE_EVENT_GENERATE | UFO_TRACE_EVENT_END);
-
- if (active) {
- ufo_group_push_output_buffer (group, output);
- output = ufo_group_pop_output_buffer (group, &requisition);
- }
- } while (active);
- }
-
if (!active)
ufo_group_finish (group);
}