summaryrefslogtreecommitdiff
path: root/script/await.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-11-02 19:25:37 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-11-02 19:25:37 +0800
commit36a5c10b00160c85a8c29170b5d5de8b27b4a5c9 (patch)
treef6db7d3d69bc24fecf16f3a3439d489dc5c43bf9 /script/await.lua
parentc16264eac3b25f6f2bce14b0504071787bd2bc54 (diff)
downloadlua-language-server-36a5c10b00160c85a8c29170b5d5de8b27b4a5c9.zip
mark async
Diffstat (limited to 'script/await.lua')
-rw-r--r--script/await.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/script/await.lua b/script/await.lua
index e92af272..a887664a 100644
--- a/script/await.lua
+++ b/script/await.lua
@@ -66,6 +66,7 @@ function m.call(callback, ...)
end
--- 创建一个任务,并挂起当前线程,当任务完成后再延续当前线程/若任务被关闭,则返回nil
+---@async
function m.await(callback, ...)
if not coroutine.isyieldable() then
return callback(...)
@@ -109,6 +110,7 @@ end
--- 休眠一段时间
---@param time number
+---@async
function m.sleep(time)
if not coroutine.isyieldable() then
if m.errorHandle then
@@ -128,6 +130,7 @@ end
--- 等待直到唤醒
---@param callback function
+---@async
function m.wait(callback, ...)
if not coroutine.isyieldable() then
return
@@ -148,6 +151,7 @@ function m.wait(callback, ...)
end
--- 延迟
+---@async
function m.delay()
if not m._enable then
return
@@ -174,6 +178,7 @@ function m.delay()
end
--- stop then close
+---@async
function m.stop()
if not coroutine.isyieldable() then
return