diff options
| author | ame <[email protected]> | 2024-05-03 13:40:55 -0500 |
|---|---|---|
| committer | ame <[email protected]> | 2024-05-03 13:40:55 -0500 |
| commit | a571dd1ac9fc4d46e0bbc95a3ab88f52ee37b1a1 (patch) | |
| tree | dbaffb5e488e0d0cf7f2fcb598ee2db1515aab05 /docs | |
| parent | 81b85b557c308ff743b7b83f2b823e508eef54eb (diff) | |
starting threads and deep copy metatables
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/thread.md | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/docs/thread.md b/docs/thread.md index 6a3b19d..aa34f5c 100644 --- a/docs/thread.md +++ b/docs/thread.md @@ -1,16 +1,43 @@ # threads ** -## llib.thread ** +## lock, unlock** + +'takes an integer + +locks any other thread reaching this lock id until a corresponding unlock is met + +```lua +llib.thread.lock(5) +... +llib.thread.unlock(5) +``` + +more indepth + +```lua +local t = llib.thread.async(function(info) + ... + llib.thread.lock(5) + ... + return N +end) + +... +llib.thread.unlock(5) +t:await() +``` + +## aync ** 'takes a function which will be ran in a separate thread with a single parameter with thread info these have the same backend (and limitations) of network threads ```lua -local thread = llib.thread(function(info) +local thread = llib.thread.async(function(info) local N = 0 ... - return N; + return N end) ``` |
