Looking to issue with issue with odp_scheduling.c

Problem can be described with following code:

Each cpu does this:

1. code allocs some events and place them to queue.
2. odp_schedule_pause();
3. odp_schedule_multi() put them back to queue.
4. odp_schedule_resume();
5. odp_barrier_wait(&globals->barrier);
6. clear_sched_queues();

static void clear_sched_queues(void)
{
    odp_event_t ev;
    int cnt = 0;

    while (1) {
        ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT);
        if (ev == ODP_EVENT_INVALID)
            break;
        odp_event_free(ev);
        cnt++;
    }
    printf("clear %d\n", cnt);
}


Now I see that some threads inside clear_sched_queues() clear more or less events. But all of them exits because invalid queue was returned.
I.e. there are some events still in scheduler.

If I call clear_sched_queues() 2 or 3 times rest of events freeing. Which looks like we have a race between threads somewhere...

Maxim.


Reply via email to