03.01.2020, 22:01
hi,
is there a way i can i have this to unlock itself after the timeout period executed by the callback?
many thanks,
require('sem')
-- wait for 5 seconds max before executing callback
res1, res2 = sem.runlocked('eventlock', 5, function(lockres)
-- lock acquired
if lockres then
return true, 'lock ok'
-- failed to acquire lock
else
return nil, 'lock failed'
end
end)
log(res1, res2)
is there a way i can i have this to unlock itself after the timeout period executed by the callback?
many thanks,
require('sem')
-- wait for 5 seconds max before executing callback
res1, res2 = sem.runlocked('eventlock', 5, function(lockres)
-- lock acquired
if lockres then
return true, 'lock ok'
-- failed to acquire lock
else
return nil, 'lock failed'
end
end)
log(res1, res2)