Skip to content

k_thread: event-driven join via task notifications (replace 10 ms polling) #35

@swoisz

Description

@swoisz

k_thread_join polls eTaskGetState/_completed at 10 ms granularity (design predates #18, which kept it). Upstream Zephyr wakes joiners immediately via wait queues.

FreeRTOS-native improvement: join registers its own handle in a _joiner field; the entry wrapper does xTaskNotifyGive(joiner) before terminating. Needs a single-joiner protocol (multi-join is already documented unsupported, see the @note on k_thread_join) and care around the abort path.

Low priority — the cost is ~10 ms join latency, mostly visible as test-suite time.

Rejected-for-now alternative from the same review: splitting per-target code into k_thread_linux.c (the k_timer precedent) — control flow is ~90% shared and a split would duplicate whole functions for ~10 divergent lines. Revisit if the linux deltas grow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    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