
---@class copas_lock_module*
---@type copas_lock_module*
local M = {}

---@class copas_lock_object*
local copas_lock_object = {}

--- Create lock.
---@param seconds? number Default number of seconds to wait.
---@param not_reentrant? boolean Whether to disable reentry.
---@return copas_lock_object* lock Lock object.
function M.new(seconds, not_reentrant) end

--- Get the lock.
---@param timeout? number Timeout seconds.
---@return number|nil waitTime Waiting time.
---@return string? errMsg error message.
---@return number? elapsed Time has waited.
function copas_lock_object:get(timeout) end

--- Release the lock.
---@return boolean|nil ok Whether it is successful or not.
---@return string? errMsg error message.
function copas_lock_object:release() end

--- Destroy the lock.
function copas_lock_object:destroy() end

return M
