Software /
code /
prosody
Annotate
teal-src/util/async.d.tl @ 12773:f100c1035576
mod_c2s: Include stream attributes in stream-features event
We need this to access 'from' in SASL2/FAST.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 14 Oct 2022 11:21:16 +0100 |
parent | 12498:c3e47a5dd30d |
rev | line source |
---|---|
12498
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 local record lib |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 ready : function () : boolean |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 waiter : function (num : integer, allow_many : boolean) : function (), function () |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 guarder : function () : function (id : function ()) : function () | nil |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 record runner_t<T> |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 func : function (T) |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 thread : thread |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 enum state_e |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 -- from Lua manual |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 "running" |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 "suspended" |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 "normal" |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 "dead" |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 -- from util.async |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 "ready" |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 "error" |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
18 end |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
19 state : state_e |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
20 notified_state : state_e |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
21 queue : { T } |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
22 type watcher_t = function (runner_t<T>, ... : any) |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
23 type watchers_t = { state_e : watcher_t } |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
24 data : any |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
25 id : string |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
26 |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
27 run : function (runner_t<T>, T) : boolean, state_e, integer |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
28 enqueue : function (runner_t<T>, T) : runner_t<T> |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
29 log : function (runner_t<T>, string, string, ... : any) |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
30 onready : function (runner_t<T>, function) : runner_t<T> |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
31 onready : function (runner_t<T>, function) : runner_t<T> |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
32 onwaiting : function (runner_t<T>, function) : runner_t<T> |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
33 onerror : function (runner_t<T>, function) : runner_t<T> |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
34 end |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
35 runner : function <T>(function (T), runner_t.watchers_t, any) : runner_t<T> |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
36 wait_for : function (any) : any, any |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
37 sleep : function (t:number) |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
38 |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
39 -- set_nexttick = function(new_next_tick) next_tick = new_next_tick; end; |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
40 -- set_schedule_function = function (new_schedule_function) schedule_task = new_schedule_function; end; |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
41 end |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
42 return lib |