summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2024-05-10 17:03:44 +0800
committer最萌小汐 <sumneko@hotmail.com>2024-05-10 17:03:44 +0800
commit43e375b7dd2a9c4e8e3e02cca51f546e38d79b31 (patch)
treee5a4fade6b1f4dfaf0ebb235e329b093585a890b /script
parentc59bd7f4765a8016dfbbf3c8c9879387ca86acfd (diff)
downloadlua-language-server-43e375b7dd2a9c4e8e3e02cca51f546e38d79b31.zip
跟进修改
Diffstat (limited to 'script')
-rw-r--r--script/brave/brave.lua12
-rw-r--r--script/meta/bee/thread.lua7
2 files changed, 13 insertions, 6 deletions
diff --git a/script/brave/brave.lua b/script/brave/brave.lua
index 5a15a6b2..34c92a72 100644
--- a/script/brave/brave.lua
+++ b/script/brave/brave.lua
@@ -1,5 +1,6 @@
local channel = require 'bee.channel'
local select = require 'bee.select'
+local thread = require 'bee.thread'
local function channel_init(chan)
local selector = select.create()
@@ -9,11 +10,14 @@ end
local function channel_bpop(ctx)
local selector, chan = ctx[1], ctx[2]
- for _ in selector:wait() do
- local r = table.pack(chan:pop())
- if r[1] == true then
- return table.unpack(r, 2)
+ while true do
+ for _ in selector:wait() do
+ local r = table.pack(chan:pop())
+ if r[1] == true then
+ return table.unpack(r, 2)
+ end
end
+ thread.sleep(10)
end
end
diff --git a/script/meta/bee/thread.lua b/script/meta/bee/thread.lua
index 2cfbbdcf..15955aff 100644
--- a/script/meta/bee/thread.lua
+++ b/script/meta/bee/thread.lua
@@ -3,7 +3,7 @@
---@class bee.thread
local thread = {}
----@param time number
+---@param time integer
function thread.sleep(time) end
---@param name string
@@ -15,7 +15,10 @@ function thread.channel(name) end
---@param script string
---@return bee.thread.thread
-function thread.thread(script) end
+function thread.create(script) end
+
+---@return string?
+function thread.errlog() end
---@class bee.thread.channel
local channel = {}