diff options
Diffstat (limited to 'docs/thread')
| -rw-r--r-- | docs/thread/async.md | 21 | ||||
| -rw-r--r-- | docs/thread/usleep.md | 5 |
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) |
