Core Function ThreadKill

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "<pre> ThreadKill( <name> ) </pre> === Description === Terminate a thread and remove it from the script === Parameters === ==== name ==== Name of a thread to check. === Retu...")
 
m (1 revision)

Revision as of 21:40, 11 August 2014

ThreadKill( <name> )

Contents

Description

Terminate a thread and remove it from the script

Parameters

name

Name of a thread to check.

Return Value

Success: Returns 1.

Failure: Returns 0 and throws an exception.

Remarks

None.

Example

ThreadCreate("th1", "ThreadFunc();");
ThreadCreate("th2", "ThreadFunc();");
ThreadCreate("th3", "ThreadFunc();");
 
println("Will wait 3 seconds then terminate threads 2 and 3");
sleep(3000);
ThreadKill("th2");
ThreadKill("th3");
println("Threads 2 and 3 are killed");
 
inputc();
 
Function ThreadFunc()
{
	while(true)
	{
		println("Hello from thread '" . ThreadName() . "'");
		sleep(1000);
	}
}
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox