47 const bool do_schedule_pause =
em_shm->opt.dispatch.sched_pause;
50 odp_schedule_resume();
54 if (do_input_poll || do_output_drain)
55 events = dispatch_with_userfn(rounds, do_input_poll, do_output_drain);
57 events = dispatch_no_userfn(rounds);
59 if (do_schedule_pause) {
68 round_events = dispatch_round(ODP_SCHED_NO_WAIT,
70 events += round_events;
71 }
while (round_events > 0);
81 "Bad argument, opt=NULL");
85 *opt = dispatch_opt_default;
100 odp_schedule_resume();
104 if (do_input_poll || do_output_drain)
105 events = dispatch_duration_with_userfn(duration, opt, results,
106 do_input_poll, do_output_drain);
108 events = dispatch_duration_no_userfn(duration, opt, results);
111 if (do_sched_pause) {
112 odp_schedule_pause();
121 round_events = dispatch_round(ODP_SCHED_NO_WAIT,
123 events += round_events;
125 }
while (round_events > 0);
128 results->
rounds += rounds;
141 "Bad argument: duration=NULL");
144 opt = &dispatch_opt_default;
148 "Bad argument: em_dispatch_opt_init(opt) not called");
154 "Bad option: 0 < opt.burst_size (%" PRIu64
") <= %u (max)",
161 (EM_DISPATCH_DURATION_LAST >> 1) << 2;
165 "Bad option: duration->select=0x%x invalid", duration->
select);
169 duration->
ns == 0) ||
173 duration->no_events.
rounds == 0) ||
175 duration->no_events.
ns == 0)),
177 "Bad option: opt.duration is zero(0).");
180 return dispatch_duration(duration, opt, results);
188 "Bad argument: ns=0");
191 opt = &dispatch_opt_default;
195 "Bad argument: em_dispatch_opt_init(opt) not called");
201 "Bad option: 0 < opt.burst_size (%" PRIu64
") <= %u (max)",
210 return dispatch_duration(&duration, opt, results);
218 "Bad argument: events=0");
221 opt = &dispatch_opt_default;
225 "Bad argument: em_dispatch_opt_init(opt) not called");
231 "Bad option: 0 < opt.burst_size (%" PRIu64
") <= %u (max)",
240 return dispatch_duration(&duration, opt, results);
248 "Bad argument: rounds=0");
251 opt = &dispatch_opt_default;
255 "Bad argument: em_dispatch_opt_init(opt) not called");
261 "Bad option: 0 < opt.burst_size (%" PRIu64
") <= %u (max)",
270 return dispatch_duration(&duration, opt, results);
280 EM_ESCOPE_DISPATCH_REGISTER_ENTER_CB,
281 "EM dispatch callbacks disabled");
283 hook_fn.disp_enter = func;
286 EM_ESCOPE_DISPATCH_REGISTER_ENTER_CB,
287 "Dispatch callback register failed");
299 EM_ESCOPE_DISPATCH_UNREGISTER_ENTER_CB,
300 "EM dispatch callbacks disabled");
302 hook_fn.disp_enter = func;
305 EM_ESCOPE_DISPATCH_UNREGISTER_ENTER_CB,
306 "Dispatch callback unregister failed");
318 EM_ESCOPE_DISPATCH_REGISTER_EXIT_CB,
319 "EM dispatch callbacks disabled");
321 hook_fn.disp_exit = func;
324 EM_ESCOPE_DISPATCH_REGISTER_EXIT_CB,
325 "Dispatch callback register failed");
336 EM_ESCOPE_DISPATCH_UNREGISTER_EXIT_CB,
337 "EM dispatch callbacks disabled");
339 hook_fn.disp_exit = func;
342 EM_ESCOPE_DISPATCH_UNREGISTER_EXIT_CB,
343 "Dispatch callback unregister failed");