EMILUA(3em)

πŸ“¦ version 0.12.1, in nixos 26.05, nixpkgs unstable

πŸ’– NAME πŸ’–

okay so this is the EMILUA(3em) page from the Emilua reference, and it's about Emilua β€” Lua execution engine. Today's main character? The system_timer, bestie. 🫢✨

🌸 DESCRIPTION 🌸

Here's the opening snippet, literally exactly this:

local timer = require('time').system_timer
local t = timer.new()

This is a timer for the system_clock. It's the same vibe as <https://www.boost.org/doc/libs/1_66_0/doc/html/boost_asio/reference/system_timer.html> in Boost.Asio (the original really does have a stray " after Boost.Asio β€” keeping the lore intact, iykyk):

A waitable timer is always in one of two states: "expired" or "not expired". If the wait() or async_wait() function is called on an expired timer, the wait operation will complete immediately. Changing an active waitable timer’s expiry time: changing the expiry time of a timer while there are pending asynchronous waits causes those wait operations to be cancelled.

πŸ¦‹ FUNCTIONS πŸ¦‹

⭐ new() β†’ system_timer

local t = system_timer.new()

Constructor. Returns a new system_timer object. Periodt. πŸ’…

⭐ expires_at(self, tp: time.system_clock.time_point) β†’ integer

This forwards the call to the Boost.Asio expires_at function with the same name at <https://www.boost.org/doc/libs/1_66_0/doc/html/boost_asio/reference/basic_waitable_timer/expires_at.html>:

Set the timer’s expiry time as an absolute time. Any pending asynchronous wait operations will be cancelled. The handler for each cancelled operation will be invoked with the boost::asio::error::operation_aborted error code. Return Value The number of asynchronous operations that were cancelled.

⭐ wait(self)

Initiate a wait operation on the timer and blocks the current fiber until one of these events occurs:

  • The timer has expired.
  • The timer was cancelled, in which case it raises boost::asio::error::operation_aborted.

⭐ cancel(self) β†’ integer

Cancel any operations that are waiting on the timer. Returns the number of asynchronous operations that were cancelled. πŸ’€βœ¨

πŸ‘‘ PROPERTIES πŸ‘‘

✨ expiry: time.system_clock.time_point

The timer’s expiry time as an absolute time.

Whether the timer has expired or not does not affect this value. No cap. 🌈

🫢 This page is from Emilua 0.12.1-nixpkgs1, dated 1980-01-01, and it's the EMILUA(3em) manual page. Bye bestie, slay responsibly. πŸ’…πŸŽ€
πŸ“¦ where this page comes from