Proper use of k_poll_signal

I'm not sure if this code I inherited is using k_poll_signal correctly because it seems like I can handle it in a much simpler way with an atomic variable.

The below code is run from a thread in a loop.

static void handle_event()
{
    ...

    if(k_poll(display_sm_events, DISP_EVENT_MAX_SIGNALS, K_NO_WAIT) == 0)
    {
        if(display_sm_events[DISP_EVENT_STARTUP_COMPLETE_SIGNAL].signal->signaled)
        {
            display_sm_events[DISP_EVENT_STARTUP_COMPLETE_SIGNAL].signal->signaled = 0;

From a different thread, the below function is called from the same module as the above code.

void disp_event_startup_complete()
{
    k_poll_signal_raise(&startup_complete_signal, 0);
}

It works but I'm not sure the current use requires the overhead of k_poll_signal.

Please share your thoughts.

Parents Reply Children
No Data
Related