Skip to content

Zephyr Threads

Under Construction

This page is a stub and still under construction. Details may be incomplete or change.

PEROVSAT application threads are standard Zephyr threads created with K_THREAD_DEFINE or started dynamically via k_thread_start().

Interval-driven loop

while (1) {
    /* work */
    k_msleep(INTERVAL_MS);
}

Event-driven loop

while (1) {
    if (k_msgq_get(&queue, &msg, K_FOREVER) == 0) {
        /* handle msg */
    }
}

Mixed wake (timeout OR event)

int ret = k_msgq_get(&queue, &msg, K_MSEC(5000));
if (ret == 0) { /* event */ }
else if (ret == -EAGAIN) { /* timeout */ }

PEROVSAT-specific pattern

Child threads that should not run at boot are defined with delay K_FOREVER. System Health calls k_thread_start(tid) when global flags allow.

See Application Threads for mission thread roles.

Official reference: Zephyr Threads.