Core Function ThreadKill
From Sputnik Wiki
(Difference between revisions)
(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) |
(One intermediate revision by one user not shown) |
Latest revision as of 12:38, 14 June 2015
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); } }