aboutsummaryrefslogtreecommitdiff
path: root/docs/thread
diff options
context:
space:
mode:
authorame <[email protected]>2025-11-04 01:47:09 -0600
committerame <[email protected]>2025-11-04 01:47:32 -0600
commit5d88c4a2b80060290467d84033082f3af0c333b2 (patch)
tree62d51c8510748187324f1a65742f5d7a2c0a4214 /docs/thread
parentc4f000153d2988e2011d68c1eb45a6a9b1927487 (diff)
thread testcancel and usleep
Diffstat (limited to 'docs/thread')
-rw-r--r--docs/thread/async.md21
-rw-r--r--docs/thread/usleep.md5
2 files changed, 22 insertions, 4 deletions
diff --git a/docs/thread/async.md b/docs/thread/async.md
index 0f04e12..98497ba 100644
--- a/docs/thread/async.md
+++ b/docs/thread/async.md
@@ -8,6 +8,21 @@ the argument function is executed by the thread until it has been completed. the
the reason for the res function it because lua_call (in the c api) requires a number or return values before you run the function
+the res function also provides some child methods for thread managment
+
+### res:testclose
+
+res:testclose()
+
+closes the thread if it is being requested to close from async:close
+
+### res:autoclose
+
+res:autoclose()
+
+calls res:testclose() every lua line, using a debug hook
+
+---
### async:await
@@ -25,12 +40,10 @@ kills the thread, this may close it in an unsafe way, and should be avoided
async:close()
-kills the thread in a more safe manor, should be preferred in most cases. however it is best to let the thread exit itself
-
-some systems may not support this (pthread_cancel) and so this function will call async:kill() in cases where it cant. android is one of the main ones
+waits for the thread to internally call res:testclose or exit
### async:clean
async:clean()
-calls the __gc metamethod, will call async:close() if it is still running
+calls the __gc metamethod, will call async:kill() if it is still running
diff --git a/docs/thread/usleep.md b/docs/thread/usleep.md
new file mode 100644
index 0000000..75208a9
--- /dev/null
+++ b/docs/thread/usleep.md
@@ -0,0 +1,5 @@
+## usleep
+
+thread.usleep(μN)
+
+puts the thread to sleep for N microseconds (duh)