-
Notifications
You must be signed in to change notification settings - Fork 18
Thread natives
native bool:thread_fix();
A thread-safe native that fixes the code to run on the main thread when it is available. If called from another thread, the thread will wait until the following code completes.
native thread_detach(sync_flags:flags);
Detaches the execution of the code from the main thread, executing it in a new thread on the next tick. flags
may specify how outer synchronisation happens in the new thread.
native thread_attach();
Attachs the execution back to the main thread.
The two functions above are wrapped in the threaded
pseudo-statement which calls them automatically when appropriate.
native thread_sync();
If the thread was created with sync_explicit
, callbacks to the code are delayed after the thread ends. Calling this function executes them immediately.
native thread_sleep(ms);
Pauses the thread for the specified number of milliseconds. Works in the main thread too (will pause the server).
native thread_id(id[], size=sizeof id);
native String:thread_id_s();
Returns the identifier of the current thread, usually numeric.