Skip to content

k_work: missing upstream APIs (K_WORK_INIT, K_WORK_DELAYABLE_DEFINE, busy_get, drain/stop, queue_start signature, system-WQ Kconfig) #25

@swoisz

Description

@swoisz

Umbrella for small k_work API-surface gaps vs upstream; each is independently landable:

  • K_WORK_INIT(handler) — struct-literal static initializer (distinct from K_WORK_DEFINE, which declares a variable). Needed for embedding k_work inside other static structs.
  • K_WORK_DELAYABLE_DEFINE(name, handler) — exists but is NOT ready-to-use (documented BEHAVIORAL DELTA: the embedded k_timer needs runtime k_work_init_delayable() because esp_timer requires esp_timer_create()). Revisit whether the linux/HW timer backends allow a true static form.
  • k_work_busy_get(work) — flag bitmask (PENDING/QUEUED/RUNNING/CANCELING); trivial wrapper over the existing flags field.
  • k_work_queue_drain / k_work_queue_stop — lifecycle APIs; _drain becomes a walk-under-lock after the dlist rewrite (k_work: rewrite queue backend from FreeRTOS xQueue to sys_dlist + k_sem #24); _stop needed for test teardown. _unplug deferred, no consumer.
  • k_work_queue_start() signature — today (queue, name, stack_size, prio); upstream is (queue, stack, stack_size, prio, const struct k_work_queue_config *cfg) with cfg carrying name/no_yield/essential. Add the config struct; keep the current signature as a deprecated shim if consumers exist.
  • System workqueue Kconfigprio=5 and stack size are hardcoded in k_work.c. Add CONFIG_SYSTEM_WORKQUEUE_PRIORITY / CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE mirroring upstream names and defaults.

Metadata

Metadata

Assignees

No one assigned

    Labels

    zephyr-parityDivergence from upstream Zephyr API/semantics

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions