Name

SPVM::Go::UV::Handle::Timer - Timer Handle for libuv

Description

Go::UV::Handle::Timer in SPVM represents the timer handle for libuv, corresponding to the uv_timer_t structure.

Super Class

Go::UV::Handle

Usage

use Go::UV::Handle::Timer;

my $timer = Go::UV::Handle::Timer->new;

Fields

timer_cb

has timer_cb : rw Go::UV::Callback::Timer;

The callback called when the timer timeout expires.

Class Methods

new

static method new : Go::UV::Handle::Timer ();

Creates a new Go::UV::Handle::Timer object, and returns it.

Instance Methods

start

method start : void ($cb : Go::UV::Callback::Timer, $timeout_msec : long, $interval_msec : long = 0);

Starts the timer with a timeout of $timeout_msec milliseconds and a repeat interval of $interval_msec milliseconds.

The callback $cb is stored in "timer_cb" field.

The callback $cb is invoked when the timer timeout expires.

This method calls the uv_timer_start function internally.

Exceptions:

If $cb is not defined, an exception is thrown.

If uv_timer_start fails, an exception is thrown.

Copyright & License

Copyright (c) 2026 Yuki Kimoto

MIT License