tulip.Semaphore module. Note that this is meant for internal use.
local Semaphore = require 'tulip.Semaphore'.
sema = Semaphore.new([n])
Returns a new Semaphore instance with a count of n, which must be positive. If not provided, defaults to 1.
ok, err = Semaphore:acquire([timeout])
Acquires access from the semaphore. If timeout is set, waits at most that time to acquire access, otherwise return nil and an error message. Returns true on success.
true = Semaphore:release()
Releases a previously acquired access, possibly unblocking processes waiting on acquire. Returns true.