Software /
code /
prosody
Comparison
util/async.lua @ 10928:79faf5b98395
util.async: Rename wait -> wait_for (w/compat)
Agreed this name is clearer and wait_for(thing) reads well in code.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 13 Jun 2020 08:01:57 +0100 |
parent | 10291:7b48b620164c |
child | 10930:69a4b0e3565f |
comparison
equal
deleted
inserted
replaced
10927:470602a8b633 | 10928:79faf5b98395 |
---|---|
244 | 244 |
245 local function ready() | 245 local function ready() |
246 return pcall(checkthread); | 246 return pcall(checkthread); |
247 end | 247 end |
248 | 248 |
249 local function wait(promise) | 249 local function wait_for(promise) |
250 local async_wait, async_done = waiter(); | 250 local async_wait, async_done = waiter(); |
251 local ret, err = nil, nil; | 251 local ret, err = nil, nil; |
252 promise:next( | 252 promise:next( |
253 function (r) ret = r; end, | 253 function (r) ret = r; end, |
254 function (e) err = e; end) | 254 function (e) err = e; end) |
264 return { | 264 return { |
265 ready = ready; | 265 ready = ready; |
266 waiter = waiter; | 266 waiter = waiter; |
267 guarder = guarder; | 267 guarder = guarder; |
268 runner = runner; | 268 runner = runner; |
269 wait = wait; | 269 wait = wait_for; -- COMPAT w/trunk pre-0.12 |
270 wait_for = wait_for; | |
270 }; | 271 }; |