diff options
| author | ame <[email protected]> | 2025-06-20 20:34:18 -0500 |
|---|---|---|
| committer | ame <[email protected]> | 2025-06-20 20:34:18 -0500 |
| commit | 76495ea9809c256ebc216e7aa2954c4e0592fd1d (patch) | |
| tree | 4f6b08a23632659199ebcb16b198ecf0ede1f5d7 /library | |
| parent | e058a29d70dd299b7fc2a84cae5824fd03fbef84 (diff) | |
thread.mutex
Diffstat (limited to 'library')
| -rw-r--r-- | library/lullaby/thread.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/library/lullaby/thread.lua b/library/lullaby/thread.lua index 1b0e89d..d4efe2d 100644 --- a/library/lullaby/thread.lua +++ b/library/lullaby/thread.lua @@ -64,4 +64,26 @@ function thread.unlock(tid) end ---@deprecated function thread.testcopy() end +---@class mutex-table +local mutex = {} + +---locks the mutex +---@param T mutex-table +---@return nil +function mutex.lock(T) end + +---unlocks the mutex +---@param T mutex-table +---@return nil +function mutex.unlock(T) end + +---frees the mutex, automatically called by __gc +---@param T mutex-table +---@return nil +function mutex.free(T) end + +---returns a mutex object, useful for solving race conditions in multi-threaded environments +---@return mutex-table +function thread.mutex() end + return thread |
