| Package | org.generalrelativity.thread.util |
| Class | public class ThreadUtil |
| Inheritance | ThreadUtil Object |
See also
| Method | Defined By | ||
|---|---|---|---|
open(processes:Vector.<IRunnable>, hertz:int, share:Number = 0.5, isDiagnostic:Boolean = false, callback:Function = null):GreenThread [static]
Opens and returns a GreenThread. | ThreadUtil | ||
openSingle(process:IRunnable, hertz:int, share:Number = 0.5, isDiagnostic:Boolean = false, callback:Function = null):GreenThread [static]
Opens a single process in its own GreenThread
This is just a helpful utility to get around verbose Vector instantiation.
| ThreadUtil | ||
| open | () | method |
public static function open(processes:Vector.<IRunnable>, hertz:int, share:Number = 0.5, isDiagnostic:Boolean = false, callback:Function = null):GreenThreadOpens and returns a GreenThread.
Note that the first 4 arguments match those in a GreenThread's constructor. If
a callback is supplied, it (Function) is called when the thread has completed. For
other handlable Events, see GreenThread.
Parameters
processes:Vector.<IRunnable> | |
hertz:int | |
share:Number (default = 0.5) | |
isDiagnostic:Boolean (default = false) | |
callback:Function (default = null) |
GreenThread |
See also
| openSingle | () | method |
public static function openSingle(process:IRunnable, hertz:int, share:Number = 0.5, isDiagnostic:Boolean = false, callback:Function = null):GreenThread
Opens a single process in its own GreenThread
This is just a helpful utility to get around verbose Vector instantiation.
Parameters
process:IRunnable | |
hertz:int | |
share:Number (default = 0.5) | |
isDiagnostic:Boolean (default = false) | |
callback:Function (default = null) |
GreenThread |
See also
GreenThread
public function openThread() : void
{
//create process
var process:IRunnable = new SomeProcess();
//creates and opens the thread, requesting onThreadComplete to be called on completion
ThreadUtil.openSingle( process, stage.frameRate, 0.5, false, onThreadComplete );
}
public function onThreadComplete() : void
{
//process done!
}