This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
CIGI Client Plugin
Rendering-Related Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Thread

int thread( string function_name, variable arguments )

Places a function into the list (FIFO) for thread initialization. The functions from this list are started at the end of any script function execution, which was called from C++ (init(), shutdown(), update() of any script). Target functions must use the wait statement to free the processor for other tasks. Each thread has its own scope.

Arguments

  • string function_name - Name of the function to place into the list for thread initialization.
  • variable arguments - Function arguments.

Return value

Thread ID. It can be used to terminate the thread via kill_thread().

Examples

Source code (UnigineScript)
void log_argument(int arg) {
	while(1) {
		log.message("Argument: %d",arg);
		wait;
	}
}

for(int i = 0; i < 10; i++) {
	thread("log_argument",i);
}

int thread( string function_name, variable array )

Places a function into the list (FIFO) for thread initialization. The number of function arguments can vary.

Arguments

  • string function_name - Name of the function to place into the list for thread initialization.
  • variable array - Function arguments. The number of arguments can vary.

Return value

Thread ID. It can be used to terminate the thread via kill_thread().

See also: Execution Sequence.

Last update: 2018-12-27
Build: ()