|
fork() creates a thread to call function and start it. fork() returns the corresponding Thread object.
|
sleep() sleeps msec milli seconds , just as Thread::sleep(msec).
|
currentThread() refers to a Thread object associated with the current execution.
|
getPriority() gets the priority of the current thread. setPriority() changes the priority of the current thread.
e.g.
fork(function (){ for (i = 0; i < 10; ++i){ println(i) flush() sleep(500) } })
|
threadGroup() displays a list of the current thread group.
e.g.
> threadGroup() java.lang.ThreadGroup[name=system,maxpri=10] Thread[Clock,12,system],daemon Thread[Idle thread,0,system],daemon Thread[Async Garbage Collector,1,system],daemon Thread[Finalizer thread,1,system],daemon java.lang.ThreadGroup[name=main,maxpri=10] Thread[main,5,main] Thread[Terminal,2,main] null