Core Function ThreadSleep
From Sputnik Wiki
(Difference between revisions)
(Created page with "<pre> ThreadSleep( <name> ) </pre> === Description === Freeze a thread and make it sleep === Parameters === ==== name ==== Name of a thread to sleep. === Return Value === ...") |
m (1 revision) |
Revision as of 21:40, 11 August 2014
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); } }