@@ -153,7 +153,35 @@ int odp_schedule_term_global(void)
for (i = 0; i < ODP_CONFIG_SCHED_PRIOS; i++) {
for (j = 0; j < QUEUES_PER_PRIO; j++) {
- if (odp_queue_destroy(sched->pri_queue[i][j])) {
+ odp_queue_t pri_q = sched->pri_queue[i][j];
+
+ for (;;) {
+ odp_event_t ev = odp_queue_deq(pri_q);
+ odp_buffer_t desc_buf;
+ queue_desc_t *desc;
+ odp_queue_t queue;
+
+ if (ev == ODP_EVENT_INVALID)
+ break;
+
+ desc_buf = odp_buffer_from_event(ev);
+ if (desc_buf == ODP_BUFFER_INVALID) {
+ ODP_ERR("Sched term: Invalid event.\n");
+ rc = -1;
+ break;
+ }
+
+ desc = odp_buffer_addr(desc_buf);
+ queue = desc->queue;
+ /* Let deq_multi_destroy do the job */
+ if (queue_is_destroyed(queue)) {
+ odp_queue_deq_multi(queue,
+ sched_local.ev,
+ MAX_DEQ);
+ }
+ }
+
+ if (odp_queue_destroy(pri_q)) {
ODP_ERR("Sched term: Queue destroy fail.\n");
rc = -1;
}
ODP_QUEUE_TYPE_SCHED queues only get marked as destroyed, they need to be removed from the pri_queues of the linux-generic scheduler Signed-off-by: Ciprian Barbu <ciprian.barbu@linaro.org> --- v3: - check ev is valid - use already set pri_q like Maxim suggested v2: - removed #if 1 and trailing whitespaces platform/linux-generic/odp_schedule.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-)