Multithreading
The Gentee language allows you to create multi-threaded scripts. In this case, part of the script can be performed in parallel, which reduces the time of its work. To execute some code in a separate thread, you must specify it in the go statement. The script will continue to perform the following constructions without waiting for the end of the code inside go, but immediately after the new thread is launched. The go statement returns the identifier of the created thread, which can be assigned to a variable of the thread type and then used in the multithreading functions. If the script has finished its work earlier than the child threads, then it will wait for all threads to finish working. If an error occurs in any of the threads while executing a multi-threaded script, all the threads are closed and the script returns this error.
You can pass any parameters in the go command. To do this, you need to specify the name of the parameter and its value separated by a colon. The type of the parameter is automatically determined by the passed value. If you pass structures or arrays, the parameter will be assigned a copy of the value.
Last updated