diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2024-04-17 15:55:00 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2024-04-17 15:55:00 +0800 |
commit | e7e57325d4d929df3652c5caaec2edbe471e9157 (patch) | |
tree | 7110c5c373e37afe4367e608083f5bd0ac2b4cec | |
parent | fe20694bfbf81961be705107cfc9765fac090c0e (diff) | |
download | lua-language-server-e7e57325d4d929df3652c5caaec2edbe471e9157.zip |
thread.sleep 改成毫秒
-rw-r--r-- | script/brave/work.lua | 2 | ||||
-rw-r--r-- | script/service/service.lua | 2 | ||||
-rw-r--r-- | test.lua | 2 | ||||
-rw-r--r-- | test/other/filewatch.lua | 6 |
4 files changed, 6 insertions, 6 deletions
diff --git a/script/brave/work.lua b/script/brave/work.lua index a6a7a41e..0514d1e2 100644 --- a/script/brave/work.lua +++ b/script/brave/work.lua @@ -65,7 +65,7 @@ end) brave.on('timer', function (time) local thread = require 'bee.thread' while true do - thread.sleep(time) + thread.sleep(math.floor(time * 1000)) brave.push('wakeup') end end) diff --git a/script/service/service.lua b/script/service/service.lua index b6056390..2c19b4f6 100644 --- a/script/service/service.lua +++ b/script/service/service.lua @@ -180,7 +180,7 @@ function m.eventLoop() local function sleep() idle() for _ = 1, 10 do - thread.sleep(0.1) + thread.sleep(100) if doSomething() then return end @@ -115,5 +115,5 @@ loadAllLibs() main() log.debug('test finish.') -require 'bee.thread'.sleep(1) +require 'bee.thread'.sleep(1000) os.exit() diff --git a/test/other/filewatch.lua b/test/other/filewatch.lua index f5d5a03d..e751c715 100644 --- a/test/other/filewatch.lua +++ b/test/other/filewatch.lua @@ -17,7 +17,7 @@ fw.event(function (ev, filename) events[#events+1] = {ev, filename} end) -thread.sleep(1) +thread.sleep(1000) events = {} fw.update() assert(#events == 1) @@ -25,7 +25,7 @@ assert(events[1][1] == 'create') fsu.saveFile(path / 'test.txt', 'modify') -thread.sleep(1) +thread.sleep(1000) events = {} fw.update() assert(#events == 1) @@ -37,7 +37,7 @@ f:write('xxx') f:flush() f:close() -thread.sleep(1) +thread.sleep(1000) events = {} fw.update() assert(#events == 1) |