mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-25 16:53:46 +01:00
19 lines
435 B
Lua
19 lines
435 B
Lua
locks={}
|
|
function request(resource, func, ...)
|
|
if locks[resource] then
|
|
table.insert(locks[resource], {func=func, args={...}})
|
|
return false
|
|
end
|
|
locks[resource]={}
|
|
return true
|
|
end
|
|
function free(resource)
|
|
if locks[resource] then
|
|
local first=locks[resource][1]
|
|
if first then
|
|
first.func(unpack(first.args), true)
|
|
end
|
|
end
|
|
locks[resource]=nil
|
|
return true
|
|
end |