amos dd1f036df3 Add 2 more batch 28 tasks measured by Qwen as MEDIUM
Batch 28 commit de6f2ac gave ESP FAT image short names and libuv timer
turns as MEDIUM; the ESP HTTP response task is being topped up. Batch 28
has 3 MEDIUM and no HARD in 20 measured so far, below batches 26 and 29.

Each task comes from the commit Qwen measured, its digest matches, and it
is still present at the batch branch head.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 18:36:52 +08:00

3.8 KiB

Timer service contract

This workspace provides the timer subset of libuv on Linux. The descriptions below collect the timer, handle, and loop API guarantees used by this service. The timer-only backend supplies milliseconds from the observer and never waits for operating system events.

R01. A successfully initialized timer is inactive, has no callback, and has a repeat interval of zero. Starting a timer with a non-null callback returns zero; its delay and repeat are unsigned 64-bit milliseconds, and its deadline is relative to the loop's current time. R02. A null callback or a timer for which closing has begun makes uv_timer_start return UV_EINVAL. An unsuccessful start leaves the timer's activity, callback, deadline, and repeat unchanged. R03. uv_close stops a timer and arranges its close callback for a later loop iteration. While the close callback is pending, the timer reports closing. Closing handle storage remains valid through the close callback. R04. Starting an active timer replaces its former schedule and repeat interval. Stopping a timer returns zero, makes it inactive, and cancels any callback that has not started; stopping an inactive timer also returns zero. R05. Expired timers are dispatched in deadline order. Equal deadlines are dispatched in the order of the most recent starts. Every timer phase takes the timers already expired at its beginning; a timer started from a timer callback, including one with delay zero, is eligible in a later timer phase. R06. A callback may start, stop, or close other timers. Those operations take effect before another callback begins. Replacing a timer whose callback is waiting cancels that invocation and schedules the replacement under the ordinary start rules. R07. A repeating timer is rearmed relative to the loop's current time before its callback runs. A delayed loop does not generate a callback for every missed interval. A repeat of zero makes a timer one-shot. uv_timer_set_repeat changes the repeat interval without changing a deadline already scheduled; uv_timer_get_repeat returns that interval. R08. uv_timer_again returns UV_EINVAL if the timer has never been started with a callback. Otherwise it returns zero. When repeat is nonzero it stops and restarts the timer using that repeat for both delay and repeat; when repeat is zero it leaves the current schedule unchanged. R09. A delay whose sum with the loop's current time exceeds UINT64_MAX is clamped to UINT64_MAX. The next timer wait is zero for an expired timer, otherwise the positive difference capped at INT_MAX, and is -1 when no timer is scheduled. R10. Referenced active handles and pending close callbacks keep the loop alive. New handles are referenced. uv_unref and uv_ref change this contribution without starting, stopping, or rescheduling the timer. The backend timeout is zero when the loop is stopped, has no referenced active handles, or has a pending close callback; otherwise it uses the next timer wait. R11. uv_run(loop, UV_RUN_NOWAIT) performs at most one iteration without waiting. When the loop is alive, that iteration updates loop time, dispatches its timer phase, runs the other loop phases, then delivers pending close callbacks. Its result reports whether referenced activity or pending close callbacks remain. uv_stop requests return at the end of the current iteration and does not discard callbacks already selected for that iteration. R12. uv_now returns the loop's current milliseconds. Updating the supplied clock and calling uv_update_time changes this value without dispatching callbacks. A timer does not run before its deadline.

The supported observer sequences initialize each timer once and retain its storage. They do not operate on a timer after its close callback, or close a timer more than once. Unrelated networking, filesystem, signal, and thread-pool APIs are outside this timer-only build.