aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorame <[email protected]>2024-05-03 13:40:55 -0500
committerame <[email protected]>2024-05-03 13:40:55 -0500
commit618263f6f85d08bfd85d4f0376663aa1e2f58eac (patch)
treedbaffb5e488e0d0cf7f2fcb598ee2db1515aab05 /docs
parent8740f3685e959d6477230cf4e8f33c7c93f9ea2b (diff)
starting threads and deep copy metatables
Diffstat (limited to 'docs')
-rw-r--r--docs/thread.md33
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)
```