tracker
All repositories: gitoria
3.3 KB
\* Timer.hl → class Timer — ONE clock event source, its lifetime, its events.`every(n)`, `after(n)` and `until(t)` all hand back one of these. The eventloop wiring lives HERE so app code never sees it: the source is registered ATthis instance, the internal fan-out re-emits `tick` at itself, and`on interval.tick()` in the app is an ordinary instance-scoped handler — thesame shape hl:proc's Process has carried since 2026-08-17.let interval = every(360)on interval.tick(t) { … } \\ t = { count, at }interval.stop()ONE EVENT NAME FOR ALL THREE. `after(n)` IS `every(n)` that fires once and`until(t)` IS `after(t - now())`; one primitive, two conveniences. Naming theone-shot's event `finished` or `isUp` would mean swapping the constructorforces rewriting the handler, and this language's events are verbs of arrival— `line`, `exit`, `chunk`, `ready`, `saved`, `tick`. *\\* The interval this timer was created with, in seconds (raised to hl:time'sfloor if it was written below it — see server.hl). *\Number seconds = 0\* True for `every()`; false for the one-shots `after()` and `until()`. *\Boolean repeating = false\* False once a one-shot has fired or `stop()` was called. An `every` whose`running` is true keeps the program alive — that is the point of it. *\Boolean running = false\* How many ticks have been delivered. 1 on a one-shot's only tick. *\Number count = 0Number #id = 0Number #srcId = 0\* Arm the timer and register its source. Called by `every`/`after`/`until`;there is no reason to call it yourself. *\start(Number secs, Boolean repeat) {let armed = __native("time.timer", secs, repeat)#id = armed.idseconds = secsrepeating = repeatrunning = true#srcId = __native("eventloop.register", armed.events, "__timerTick")// ONE TICK AT A TIME (ticket #159): a tick handler that waits (a fetch parks its fiber and the// loop runs the others) is not entered again by this clock; the next tick comes once it returned// (a LITERAL op, NativeCompile.hl `nativeCall` → hl_eventloop_serial: a computed one would make// every program importing hl:time, the compiler too, link dynamic — ticket #165)__native("eventloop.serial", #srcId)return this}on __timerTick(ev) {count = ev.countif (repeating == false) {// A SPENT ONE-SHOT RETIRES ITS SOURCE, BEFORE the tick is emitted.// Mission 249 found the same defect in hl:proc on 2026-08-29: a child// that had exited left its source registered, so the loop still held// something that would never speak again and NO hl:proc program could// ever end. An `after()` that does not retire hangs every program that// uses one, which is why the test for this asserts TERMINATION and not// output.running = false__native("eventloop.unregister", #srcId)__native("time.timer_stop", #id)}emit tick(ev)return null}\* Stop an interval (and end the program, if it was the only thing keeping italive) — the counterpart of `server.kill()`. True when this call was the onethat stopped it; false if it had already fired or been stopped. *\stop() {if (running == false) {return false}running = false// ORDER IS LOAD-BEARING: retire the source first, so the loop has dropped// this fd from its epoll set before the fd is closed.__native("eventloop.unregister", #srcId)__native("time.timer_stop", #id)return true}
Branches
Latest commits
- 59ef1e4atests/browser: repair 'done' check counts the 404 titles the first run already finished (race: failed=1 when Bulk Film 79 ran before the restart)mre
- 5925fc4dreports/MK-mobile.md: rebase update, gate countsmre
- 6adbc7f0extlink badges: background-clip after the background shorthand (it reset the clip: the pills were 44 px tall); gates check the lookmre
- 8d3b0f20widget: the franchise link's 44 px tap area no longer overlaps the Prequel/Sequel rowmre
- 1d98dcfdbrowser gate: the badges' size check reads the padding box (the 44 px tap area is transparent border)mre
- 2f9e29ffreports/MK-mobile.md, deploy.sh GATES: tests/mobile.mjs, theme check markermre
- 7cfc8ab5a season of more than 150 episodes starts closed on its title page; the phone gate checks itmre
- 59095c59tests/mobile.mjs: the phone gate (390 px touch, tap targets, /franchises paging)mre
- 105309detap targets: every row link, the TMDB/IMDb badges, the widget links, the franchise names and the login-failed link are 44 px high on a phonemre
- f0b86c8efranchises: 40 loose timelines per page (/franchises/page/N) and a merge sort for the names (1,546 timelines: 20 s and 54,000 px before)mre
- b9e841a7Merge branch 'sy-sync'mre
- d1ae2701sync components.hybriel 4922f9c: modal and pagination 44 px targets (vendored copies, verbatim) (SY)mre
- 043624b2theme: sync from layouts 4994037 (list rows stack, td word-keep, heading code, edited tap target)mre
- 05d89fd0deploy: security gate (tests/security.mjs)mre
- 2ae8a47bMerge branch 'sk-sec'mre
- 8fee5d52sessions last 99 years (creator 2026-10-23: logins never expire; only sign out ends them)mre
- 944ad51eSK: report reports/SK-sec.md, LOGsk
- 415487c1SK: import budget per user + id type check, gate checkssk
- 7b8a4f74security audit SK: nosniff + image sandbox headers, face id checks, adult follow, login budget + new session at login, guest-link budget, tests/security.mjssk
- f0f26c5areports: T18 section (gates, boot-gate, 3x3 table, search + short-id compare)mre