~mna/tulip

The tulip.Semaphore module. Note that this is meant for internal use.

#API

Assuming 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.

Back to index

About this wiki

commit 3ebfbd288b8e5c95fdf8ce2027a0e94cfa1c8976
Author: Martin Angers <martin.n.angers@gmail.com>
Date:   2021-02-25T14:07:12-05:00

Update to reflect Request:validate_body
Clone this wiki
https://git.sr.ht/~mna/tulip-wiki (read-only)
git@git.sr.ht:~mna/tulip-wiki (read/write)