diff options
author | Kim Alvefur <zash@zash.se> | 2022-12-12 07:10:54 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2022-12-12 07:10:54 +0100 |
commit | 080d7974bf0c1da8a1c0578d67c3172facc9d719 (patch) | |
tree | 838d6904e47ab8681928b37701ff4f1c6e89184a /teal-src/util/async.d.tl | |
parent | baff85a52c5fda705e8b3699410c770f015d89ab (diff) | |
parent | c916ce76ee89dca32e7e653dff1ade4732462efc (diff) | |
download | prosody-080d7974bf0c1da8a1c0578d67c3172facc9d719.tar.gz prosody-080d7974bf0c1da8a1c0578d67c3172facc9d719.zip |
Merge 0.12->trunk
Diffstat (limited to 'teal-src/util/async.d.tl')
-rw-r--r-- | teal-src/util/async.d.tl | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/teal-src/util/async.d.tl b/teal-src/util/async.d.tl new file mode 100644 index 00000000..a2e41cd6 --- /dev/null +++ b/teal-src/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<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<T>, ... : any) + type watchers_t = { state_e : watcher_t } + data : any + id : string + + run : function (runner_t<T>, T) : boolean, state_e, integer + enqueue : function (runner_t<T>, T) : runner_t<T> + log : function (runner_t<T>, string, string, ... : any) + onready : function (runner_t<T>, function) : runner_t<T> + onready : function (runner_t<T>, function) : runner_t<T> + onwaiting : function (runner_t<T>, function) : runner_t<T> + onerror : function (runner_t<T>, function) : runner_t<T> + end + runner : function <T>(function (T), runner_t.watchers_t, any) : runner_t<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 |