Thread-like wrappers around coroutine-backed OpenOS processes with event-aware suspension and joining.
- Repository:
opencomputers - System:
openos - Type:
library
OpenComputers/src\main\resources\assets\opencomputers\loot\openos\lib\thread.lua
local thread = require("thread")- Description: Start a new managed thread around a Lua function and return the thread handle immediately.
- Parameters:
fp: Function that becomes the thread body....: Arguments passed to the thread function on its first resume.
local worker = thread.create(function(name) print(name) end, 'job-1')- Description: Return the thread handle associated with the currently running process stack, if any.
local self = thread.current()- Description: Block until every thread in the list has stopped running or the timeout expires.
- Parameters:
threads: Array of thread handles returned bythread.create.timeout: Optional maximum number of seconds to wait.
thread.waitForAll(workers, 5)- Description: Block until any thread in the list stops running or the timeout expires.
- Parameters:
threads: Array of thread handles returned bythread.create.timeout: Optional maximum number of seconds to wait.
thread.waitForAny(workers, 1)- Only exported module functions are listed on this page.