os_thread_create
Declaration
os_thread_create :: fn (entry: OSThreadEntryFn, args: ...) OSThread
Description
Create new thread and execute entry function with passed set of arguments.
Warning
Thread must be released by os_thread_join
call.
Arguments
entry
Pointer to function started in new thread.
Result
New thread.
Example
// Worker function called from new thread.
worker :: fn (args: []Any) {
print("Thread started!\n");
os_sleep_ms(1000.0);
}
main :: fn () s32 {
// Create and execute thread without parameters.
t :: os_thread_create(&worker);
// Wait for thread.
os_thread_join(t);
print("Thread joined.\n");
return 0;
}
Declared in: docs.txt