Module ctr.thread

The thread module.

Usage:

    local thread = require("ctr.thread")

Functions

start (code[, poolSize=0[, cpu=0[, priority=0x27[, stacksize=0x100000]]]]) Start a new thread.
:join ([timeout=2^32-1]) Wait for a thread to finish.
:lastError () Return the last error of a thread.
:destroy () Destroy a finished thread.


Functions

start (code[, poolSize=0[, cpu=0[, priority=0x27[, stacksize=0x100000]]]])
Start a new thread.

Parameters:

  • code string Lua code to load in the new thread. May not work with dumped functions.
  • poolSize number size of the RAM pool for the thread (used to communicate with the main thread) (default 0)
  • cpu number must be >= 0 and < 2 for 3ds or < 4 for new3ds (default 0)
  • priority number must be > 0x18 and < 0x3f; the lower is higher. (default 0x27)
  • stacksize number size of the stack, increase it in case of OoM (default 0x100000)

Returns:

    thread a new thread object
:join ([timeout=2^32-1])
Wait for a thread to finish.

Parameters:

  • timeout number in ns (default 2^32-1)

Returns:

  1. number exit code
  2. string last error, or nil
:lastError ()
Return the last error of a thread.

Returns:

    string last error, or nil
:destroy ()
Destroy a finished thread.
generated by LDoc 1.4.3 Last updated 2017-06-05 14:35:27