Hi,

I’m looking at using the default eventq (or allowing for it), in a library I’m working on. In order to do that, I have a function:

static struct os_eventq *
sensor_mgr_evq_get(void)
{
    os_eventq_ensure(&sensor_mgr.mgr_eventq, NULL);

    return (sensor_mgr.mgr_eventq);
}

And this function gets called within my package’s sysinit, as I want to schedule a callout to run this function immediately on bootup:

    /**
     * Initialize sensor polling callout and set it to fire on boot.
     */
os_callout_init(&sensor_mgr.mgr_wakeup_callout, sensor_mgr_evq_get(),
            sensor_mgr_wakeup_event, NULL);
    os_callout_reset(&sensor_mgr.mgr_wakeup_callout, 0);

The problem is that the default event queue is not setup until after sysinit executes, as task setup is later on.

What is the right way to do this? For now, I can move the initialization from sysinit and to the main() function at task level, however, I don’t think this is how we want to manage initialization over time. We probably need some way for a package to have a system initialization stage that runs after the OS has started, and the default event queue has been set.

Cheers,

Sterling

Reply via email to