lanes uses a threaded function like waitfor function
This commit is contained in:
parent
b4c3708f50
commit
946217310f
8
init.lua
8
init.lua
@ -1226,7 +1226,9 @@ end
|
||||
function multi.hold(func,opt)
|
||||
if thread.isThread() then return thread.hold(func, opt) end
|
||||
local proc = multi.getCurrentTask()
|
||||
proc:Pause()
|
||||
if proc then
|
||||
proc:Pause()
|
||||
end
|
||||
local rets
|
||||
thread:newThread("Hold_func",function()
|
||||
rets = {thread.hold(func,opt)}
|
||||
@ -1234,7 +1236,9 @@ function multi.hold(func,opt)
|
||||
while rets == nil do
|
||||
multi:uManager()
|
||||
end
|
||||
proc:Resume()
|
||||
if proc then
|
||||
proc:Resume()
|
||||
end
|
||||
return multi.unpack(rets)
|
||||
end
|
||||
|
||||
|
||||
@ -48,14 +48,12 @@ local function INIT(__GlobalLinda, __SleepingLinda, __StatusLinda, __Console)
|
||||
end
|
||||
|
||||
function THREAD.waitFor(name)
|
||||
local function wait()
|
||||
local multi, thread = require("multi"):init()
|
||||
return multi.hold(function()
|
||||
math.randomseed(os.time())
|
||||
__SleepingLinda:receive(.001, "__non_existing_variable")
|
||||
end
|
||||
repeat
|
||||
wait()
|
||||
until __GlobalLinda:get(name)
|
||||
return __GlobalLinda:get(name)
|
||||
return __GlobalLinda:get(name)
|
||||
end)
|
||||
end
|
||||
|
||||
function THREAD.getCores()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user