From efca84e8b5204c4d5ce28113474df0bf0b67dbf3 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Tue, 13 Oct 2026 16:55:45 +0300 Subject: Wake and post to loops from any thread, and watch signals wsap_term runs its own eventfds to wake the loop from its pty worker and accessibility threads, and its own signalfd or self-pipe per platform. yasl_loop_kick() is now documented as safe from any thread and from a signal handler. yasl_loop_post() queues a function to run on the owning thread during a later step. yasl_loop_watch_signals() installs a process-wide SA_RESTART handler per signal that records the signal and kicks the loop, so callbacks run on the loop thread on every platform without touching thread masks. Cocoa dispatch waited only for AppKit events, so kicks, posts, and fd watches could not end an indefinite wait, and yasl_post_event() did not wake yasl_run(). While waiting, Cocoa now mirrors the loop's descriptors in a kqueue whose run loop source posts a wake event. If kqueue rejects a descriptor, the wait is bounded to 10 ms. The Cocoa change is not built or run here; it needs a macOS check. Co-Authored-By: Claude Opus 5.5 --- tests/meson.build | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/meson.build') diff --git a/tests/meson.build b/tests/meson.build index 980f5db..f072d3f 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -109,6 +109,14 @@ timer_test = executable( ) test('timers', timer_test) +loop_test = executable( + 'yasl-loop-test', + 'common/test_loop.c', + include_directories: inc, + dependencies: [yasl_dep, dependency('threads')], +) +test('loop', loop_test) + app_test = executable( 'yasl-app-test', 'common/test_app.c', -- cgit v1.2.3