From f68336b96e0d843511bb1bd3fdac8bba2fe4573a Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 23 Mar 2023 13:36:52 +0100 Subject: teal: Move into prosody namespace --- teal-src/prosody/util/async.d.tl | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 teal-src/prosody/util/async.d.tl (limited to 'teal-src/prosody/util/async.d.tl') diff --git a/teal-src/prosody/util/async.d.tl b/teal-src/prosody/util/async.d.tl new file mode 100644 index 00000000..a2e41cd6 --- /dev/null +++ b/teal-src/prosody/util/async.d.tl @@ -0,0 +1,42 @@ +local record lib + ready : function () : boolean + waiter : function (num : integer, allow_many : boolean) : function (), function () + guarder : function () : function (id : function ()) : function () | nil + record runner_t + func : function (T) + thread : thread + enum state_e + -- from Lua manual + "running" + "suspended" + "normal" + "dead" + + -- from util.async + "ready" + "error" + end + state : state_e + notified_state : state_e + queue : { T } + type watcher_t = function (runner_t, ... : any) + type watchers_t = { state_e : watcher_t } + data : any + id : string + + run : function (runner_t, T) : boolean, state_e, integer + enqueue : function (runner_t, T) : runner_t + log : function (runner_t, string, string, ... : any) + onready : function (runner_t, function) : runner_t + onready : function (runner_t, function) : runner_t + onwaiting : function (runner_t, function) : runner_t + onerror : function (runner_t, function) : runner_t + end + runner : function (function (T), runner_t.watchers_t, any) : runner_t + wait_for : function (any) : any, any + sleep : function (t:number) + + -- set_nexttick = function(new_next_tick) next_tick = new_next_tick; end; + -- set_schedule_function = function (new_schedule_function) schedule_task = new_schedule_function; end; +end +return lib -- cgit v1.2.3