Difference between revisions of "Core.asyncThread"

From GiderosMobile
(Created page with "'''Available since:''' Gideros 2022.9<br/> '''Class:''' Core<br/> === Description === Launches a function on a separate thread as a parallel task. <source lang="lua"> Cor...")
 
m (Text replacement - "<source" to "<syntaxhighlight")
Line 4: Line 4:
 
=== Description ===
 
=== Description ===
 
Launches a function on a separate thread as a parallel task.
 
Launches a function on a separate thread as a parallel task.
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
Core.asyncThread(task,parameters)
 
Core.asyncThread(task,parameters)
 
</source>
 
</source>

Revision as of 15:26, 13 July 2023

Available since: Gideros 2022.9
Class: Core

Description

Launches a function on a separate thread as a parallel task. <syntaxhighlight lang="lua"> Core.asyncThread(task,parameters) </source>

Parallel threads are executed in parallel with main thread.Care should be taken to avoid messing with main thread or other threads data. See table.share for making lua tables thread safe, and check various API thread safety.

Parameters

task: (function) function to run in parallel
parameters: (multiple) multiple parameters to pass to function optional