tiny.sys.event.Timer
Defined in event.
API (7)
Actions
Public operations.
Types and contracts
Public types and contracts.
Values and defaults
Public values and defaults.
Source
Source: lib/sys/src/event/poll.zig:555
zig
pub const Timer = struct { pub const delayed_tick_slots_max: u8 = 1; pub const RunError = error{ Canceled, Unexpected, }; pub const Repeat = union(enum) { fixed_delay: time.Duration, fixed_rate: time.Duration, }; pub const Schedule = struct { after: time.Duration, repeat: ?Repeat = null, }; pub fn init() !Timer { return .{}; } pub fn deinit(self: *Timer) void { self.* = undefined; } pub fn run( self: Timer, loop: *Loop, completion: *Completion, schedule: Schedule, comptime Userdata: type, userdata: ?*Userdata, comptime cb: *const fn ( ud: ?*Userdata, loop: *Loop, completion: *Completion, result: RunError!void, ) CallbackAction, ) time.ClockError!void { _ = self; if (schedule.repeat) |repeat| switch (repeat) { .fixed_delay => {}, .fixed_rate => |interval| std.debug.assert(!interval.isZero()), }; const now = try loop.readInstant(); loop.arm( completion, .{ .timer = .{ .deadline = now.deadlineAfter(schedule.after), .repeat = schedule.repeat, } }, userdata, TimerRunCallback(Userdata, cb).callback, ); }};Source: lib/sys/src/event/root.zig:27
zig
pub const Timer = backend.Timer;Complete caller list for event.Timer.deinit
9 direct callers.
lib.sys.src.event.poll.test_event_TCP_close_replaces_an_unrelated_active_completion[function] — test source atlib/sys/src/event/poll.zig:1590in nearest public ownerlib.sys.src.event.polllib.sys.src.event.poll.test_event_loop_disarm_releases_an_active_completion[function] — test source atlib/sys/src/event/poll.zig:1231in nearest public ownerlib.sys.src.event.polllib.sys.src.event.poll.test_event_loop_fake_clock_cancellation_prevents_a_delayed_timer[function] — test source atlib/sys/src/event/poll.zig:1301in nearest public ownerlib.sys.src.event.polllib.sys.src.event.poll.test_event_loop_fake_clock_orders_and_delays_timers[function] — test source atlib/sys/src/event/poll.zig:1262in nearest public ownerlib.sys.src.event.polllib.sys.src.event.poll.test_event_loop_fixed_delay_starts_after_a_late_callback[function] — test source atlib/sys/src/event/poll.zig:1359in nearest public ownerlib.sys.src.event.polllib.sys.src.event.poll.test_event_loop_fixed_rate_skips_delayed_ticks_within_one_slot[function] — test source atlib/sys/src/event/poll.zig:1327in nearest public ownerlib.sys.src.event.polllib.sys.src.event.poll.test_event_loop_rejects_an_awake_clock_regression[function] — test source atlib/sys/src/event/poll.zig:1390in nearest public ownerlib.sys.src.event.polllib.sys.src.event.poll.test_event_loop_replaces_an_active_completion_without_consuming_another_entry[function] — test source atlib/sys/src/event/poll.zig:1199in nearest public ownerlib.sys.src.event.polllib.sys.src.event.poll.test_event_loop_timer_uses_owned_sys_event_types[function] — test source atlib/sys/src/event/poll.zig:1123in nearest public ownerlib.sys.src.event.poll
Complete caller list for event.Timer.init
9 direct callers.
lib.sys.src.event.poll.test_event_TCP_close_replaces_an_unrelated_active_completion[function] — test source atlib/sys/src/event/poll.zig:1590in nearest public ownerlib.sys.src.event.polllib.sys.src.event.poll.test_event_loop_disarm_releases_an_active_completion[function] — test source atlib/sys/src/event/poll.zig:1231in nearest public ownerlib.sys.src.event.polllib.sys.src.event.poll.test_event_loop_fake_clock_cancellation_prevents_a_delayed_timer[function] — test source atlib/sys/src/event/poll.zig:1301in nearest public ownerlib.sys.src.event.polllib.sys.src.event.poll.test_event_loop_fake_clock_orders_and_delays_timers[function] — test source atlib/sys/src/event/poll.zig:1262in nearest public ownerlib.sys.src.event.polllib.sys.src.event.poll.test_event_loop_fixed_delay_starts_after_a_late_callback[function] — test source atlib/sys/src/event/poll.zig:1359in nearest public ownerlib.sys.src.event.polllib.sys.src.event.poll.test_event_loop_fixed_rate_skips_delayed_ticks_within_one_slot[function] — test source atlib/sys/src/event/poll.zig:1327in nearest public ownerlib.sys.src.event.polllib.sys.src.event.poll.test_event_loop_rejects_an_awake_clock_regression[function] — test source atlib/sys/src/event/poll.zig:1390in nearest public ownerlib.sys.src.event.polllib.sys.src.event.poll.test_event_loop_replaces_an_active_completion_without_consuming_another_entry[function] — test source atlib/sys/src/event/poll.zig:1199in nearest public ownerlib.sys.src.event.polllib.sys.src.event.poll.test_event_loop_timer_uses_owned_sys_event_types[function] — test source atlib/sys/src/event/poll.zig:1123in nearest public ownerlib.sys.src.event.poll
Complete caller list for event.Timer.run
9 direct callers.
lib.sys.src.event.poll.test_event_TCP_close_replaces_an_unrelated_active_completion[function] — test source atlib/sys/src/event/poll.zig:1590in nearest public ownerlib.sys.src.event.polllib.sys.src.event.poll.test_event_loop_disarm_releases_an_active_completion[function] — test source atlib/sys/src/event/poll.zig:1231in nearest public ownerlib.sys.src.event.polllib.sys.src.event.poll.test_event_loop_fake_clock_cancellation_prevents_a_delayed_timer[function] — test source atlib/sys/src/event/poll.zig:1301in nearest public ownerlib.sys.src.event.polllib.sys.src.event.poll.test_event_loop_fake_clock_orders_and_delays_timers[function] — test source atlib/sys/src/event/poll.zig:1262in nearest public ownerlib.sys.src.event.polllib.sys.src.event.poll.test_event_loop_fixed_delay_starts_after_a_late_callback[function] — test source atlib/sys/src/event/poll.zig:1359in nearest public ownerlib.sys.src.event.polllib.sys.src.event.poll.test_event_loop_fixed_rate_skips_delayed_ticks_within_one_slot[function] — test source atlib/sys/src/event/poll.zig:1327in nearest public ownerlib.sys.src.event.polllib.sys.src.event.poll.test_event_loop_rejects_an_awake_clock_regression[function] — test source atlib/sys/src/event/poll.zig:1390in nearest public ownerlib.sys.src.event.polllib.sys.src.event.poll.test_event_loop_replaces_an_active_completion_without_consuming_another_entry[function] — test source atlib/sys/src/event/poll.zig:1199in nearest public ownerlib.sys.src.event.polllib.sys.src.event.poll.test_event_loop_timer_uses_owned_sys_event_types[function] — test source atlib/sys/src/event/poll.zig:1123in nearest public ownerlib.sys.src.event.poll
Audit
| Definitions | 8 |
|---|---|
| Public names | 8 |
| Members | 6 |
| Version | 26.7.0 |
| Revision | daab053ee433 |