aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-29 18:04:24 +0100
committereunhhu <[email protected]>2026-09-29 18:04:43 +0100
commit8fe9ce66573be53ff56fe2a8afc693dabeae9585 (patch)
treeb556788225296e84a6a5082c2927295588a6955a /Makefile
parente710b93588782135365f01bb8351edb3bf4f95ac (diff)
downloadpure-8fe9ce66573be53ff56fe2a8afc693dabeae9585.tar.gz
pure-8fe9ce66573be53ff56fe2a8afc693dabeae9585.zip
Tick a stateless app's timers, and wait for them on the monotonic clock
run_timers ticked nothing in an app without states, taking a timer to be able to change nothing else; but a tick may send, and the outbox is the app's state (the host gives such an app an owner for it). A timer that only sends never ticked (review 004, F4). Now an app ticks when it has states or outputs; one with neither runs on every connection thread and has nothing a tick could do. When a timer is due was reckoned on the wall clock: set back, a timer waited for the time it had reached again (review 004, an earlier P2). The next tick is now reckoned on the monotonic clock; events still see the wall clock (now). check.py's server_timers runs the review's heartbeat (a timer, an output, no state) and sees it tick, then again with the wall clock set back an hour 0.2 s in (build/clock-back.so, an LD_PRELOAD of clock_gettime): 29 ticks in 0.6 s, where the server before this stops at 9.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile6
1 files changed, 5 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index d14510e..3e3e143 100644
--- a/Makefile
+++ b/Makefile
@@ -85,6 +85,10 @@ $(BUILD)/test-message-json: serve/test-message-json.c serve/message-json.c $(BUI
$(CC) $(CPPFLAGS) $(CFLAGS) $(INCLUDES) -Iserve serve/test-message-json.c serve/message-json.c $(BUILD)/libpure.a \
$(LDFLAGS) -lm $(LDLIBS) -o $@
+# LD_PRELOAD: the wall clock set back an hour, to see timers go on (tests/check.py).
+$(BUILD)/clock-back.so: tests/clock-back.c
+ $(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -shared tests/clock-back.c $(LDFLAGS) -ldl $(LDLIBS) -o $@
+
# A module run ranged and not from the same inputs, compared (tests/check.py).
$(BUILD)/module-probe: tests/module-probe.c $(BUILD)/libpure.a $(HEADERS)
$(CC) $(CPPFLAGS) $(CFLAGS) $(INCLUDES) tests/module-probe.c $(BUILD)/libpure.a $(LDFLAGS) -lm $(LDLIBS) -o $@
@@ -101,7 +105,7 @@ $(BUILD)/test-tree-store: store/test-tree-store.c $(STORE) $(HEADERS)
# compare documents with the earlier document server.
AUP ?= ../aup
check: all $(BUILD)/test-module $(BUILD)/test-tree-store $(BUILD)/test-log $(BUILD)/test-link $(BUILD)/test-message-json \
- $(BUILD)/module-probe
+ $(BUILD)/module-probe $(BUILD)/clock-back.so
$(BUILD)/test-tree-store
$(BUILD)/test-log
$(BUILD)/test-module