Core Function ThreadSleep

From Sputnik Wiki
Jump to: navigation, search
ThreadSleep( <name> )

Contents

Description

Freeze a thread and make it sleep

Parameters

name

Name of a thread to sleep.

Return Value

Success: Returns 1.

Failure: Returns 0.

Remarks

None

Example

ThreadCreate("th1", "ThreadFunc();");
ThreadCreate("th2", "ThreadFunc();");
ThreadCreate("th3", "ThreadFunc();");
 
println("Lets sleep 2 seconds...");
sleep(2000);
println("Lets make thread 2 sleep...");
ThreadSleep("th2");
println("Thread 2 is sleeping.... Now lets sleep for 3 seconds");
sleep(3000);
ThreadResume("th2");
println("Thread 2 is now resumed");
 
inputc();
 
Function ThreadFunc()
{
	while(true)
	{
		println("Hello from thread '" . ThreadName() . "'");
		sleep(500);
	}
}
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox