Skip to content

0.18.2: the stop word wakes a context waiting upon it - #41

Merged
Sunrisepeak merged 1 commit into
mainfrom
openkal-linux-0.18.2
Oct 27, 2026
Merged

Sunrisepeak merged 1 commit into
mainfrom
openkal-linux-0.18.2

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

The stop handler woke the stop word as a shared futex (FUTEX_WAKE), and kal_task_wait waits on it as a private one (FUTEX_WAIT | FUTEX_PRIVATE_FLAG). The kernel keys the two apart, so a context waiting upon the word with no bound was never woken by a request: a program that ends at a request by waiting for it (mcpplibs.os interrupt::wait, mcpp's watcher) never ended. Measured in mcpp: SIGINT during a build with a four-second action had no effect, and the build finished with status 0.

The handler now wakes with FUTEX_WAKE | FUTEX_PRIVATE_FLAG, the operation kal_task_wake performs.

tests/stop_word_take_over.cpp gains the case: a context waits upon the word with kal_task_wait(word, 0, 0) and the program sends itself SIGTERM; the context is woken within two seconds. The case fails on 0.18.1.

openkal-macos waits and wakes the word with the same UL_COMPARE_AND_WAIT operation and openkal-windows with WaitOnAddress/WakeByAddressAll; neither has this defect.

Co-authored-by: speak-agent 248744407+speak-agent@users.noreply.github.com

…x, as kal_task_wait waits)

Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
@Sunrisepeak
Sunrisepeak merged commit d33e5c4 into main Oct 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant