From 650461419a8540f03c6c261dcc4c2616120126b7 Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Thu, 12 Feb 2026 10:16:19 -0500 Subject: [PATCH] Add support for multiple timers. Signed-off-by: Piotr Sikora --- abi-versions/vNEXT/README.md | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/abi-versions/vNEXT/README.md b/abi-versions/vNEXT/README.md index 1a0f9be..f68b3f6 100644 --- a/abi-versions/vNEXT/README.md +++ b/abi-versions/vNEXT/README.md @@ -377,6 +377,32 @@ Returned `errno` value is: ### Functions exposed by the host +#### `proxy_create_timer` + +* params: + - `i32 (uint32_t) tick_period` + - `i32 (bool) one_time` + - `i32 (uint32_t*) return_timer_id` +* returns: + - `i32 (`[`proxy_status_t`]`) status` + +Creates a new timer. + +When a timer is created as a one-time alarm (`one_time`), then +the [`proxy_on_tick`] callback will be called only once after `tick_period` +milliseconds. + +Otherwise, the [`proxy_on_tick`] callback is going to be called every +`tick_period` milliseconds until the timer is deleted using +[`proxy_delete_timer`] with the returned unique timer identifier +(`return_timer_id`). + +Returned `status` value is: +- `OK` on success. +- `INVALID_MEMORY_ACCESS` when `return_timer_id` points to invalid memory +address. + + #### `proxy_set_tick_period_milliseconds` * params: @@ -395,6 +421,20 @@ Returned `status` value is: - `UNKNOWN_RESOURCE_ID` for unknown `timer_id`. +#### `proxy_delete_timer` + +* params: + - `i32 (uint32_t) timer_id` +* returns: + - `i32 (`[`proxy_status_t`]`) status` + +Deletes previously created timer (`timer_id`). + +Returned `status` value is: +- `OK` on success. +- `UNKNOWN_RESOURCE_ID` for unknown `timer_id`. + + ### Callbacks exposed by the Wasm module #### `proxy_on_tick`