This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

semaphore unlock after timeout
#1
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)
Reply


Messages In This Thread
semaphore unlock after timeout - by benanderson_475 - 03.01.2020, 22:01
RE: semaphore unlock after timeout - by admin - 06.01.2020, 15:18

Forum Jump: