| Package | org.generalrelativity.thread |
| Class | public final class GreenThread |
| Inheritance | GreenThread flash.events.EventDispatcher |
See also
| Property | Defined By | ||
|---|---|---|---|
| diagnostic : GreenThreadDiagnostic [read-only]
Gets this thread's diagnostic, if any
| GreenThread | ||
| isOpen : Boolean [read-only]
Determines whether the thread is open based on the existence of runner and processes
| GreenThread | ||
| isRunning : Boolean [read-only] | GreenThread | ||
| Method | Defined By | ||
|---|---|---|---|
GreenThread(processes:Vector.<IRunnable>, hertz:int, share:Number = 0.5, isDiagnostic:Boolean = false)
Constructor
Creates a new GreenThread. | GreenThread | ||
close(terminateProcesses:Boolean = true):GreenThreadDiagnostic
Closes the thread and readies itself for garbage collection
| GreenThread | ||
open():void
Opens the thread
This is called to first open, and to reopen after forcing the thread to yield
| GreenThread | ||
removeProcess(process:IRunnable):void
Removes a process from the list, if actually in list
| GreenThread | ||
yield():void
Forces the thread to yield
| GreenThread | ||
| Event | Summary | Defined By | ||
|---|---|---|---|---|
| Dispatched when the thread has successfully executed all requested processes | GreenThread | |||
| Dispatched when the thread has completed a cycle | GreenThread | |||
| Dispatched whenever a process has completed executing | GreenThread | |||
| Dispatched whenever a process has thrown a script timeout exception | GreenThread | |||
| Constant | Defined By | ||
|---|---|---|---|
| CYCLE : String = cycle [static] | GreenThread | ||
| EPSILON : int = 1 [static]
Minimum contribution- will have to tweak this based on testing
| GreenThread | ||
| diagnostic | property |
diagnostic:GreenThreadDiagnostic [read-only] Gets this thread's diagnostic, if any
public function get diagnostic():GreenThreadDiagnostic| isOpen | property |
isOpen:Boolean [read-only] Determines whether the thread is open based on the existence of runner and processes
public function get isOpen():Boolean| isRunning | property |
isRunning:Boolean [read-only] public function get isRunning():Boolean| GreenThread | () | Constructor |
public function GreenThread(processes:Vector.<IRunnable>, hertz:int, share:Number = 0.5, isDiagnostic:Boolean = false)Constructor
Creates a new GreenThread. If isDiagnostic is set to true, a diagnostic is performed
during thread execution.
processes:Vector.<IRunnable> — Sets processes
| |
hertz:int — Frequency at which thread is executed
| |
share:Number (default = 0.5) — Percentage of VM processor that this thread should occupy
| |
isDiagnostic:Boolean (default = false) — Sets diagnostic mode
|
Error — if no processes are passed
|
| close | () | method |
public function close(terminateProcesses:Boolean = true):GreenThreadDiagnosticCloses the thread and readies itself for garbage collection
Parameters
terminateProcesses:Boolean (default = true) — Flags whether to explicitly terminate all open processes
|
GreenThreadDiagnostic |
| open | () | method |
public function open():voidOpens the thread
This is called to first open, and to reopen after forcing the thread to yield
See also
| removeProcess | () | method |
public function removeProcess(process:IRunnable):voidRemoves a process from the list, if actually in list
Parameters
process:IRunnable |
| yield | () | method |
public function yield():voidForces the thread to yield
| complete | Event |
flash.events.Eventflash.event.Event.COMPLETEDispatched when the thread has successfully executed all requested processes
| cycle | Event |
GreenThreadGreenThread.CYCLEDispatched when the thread has completed a cycle
| processComplete | Event |
org.generalrelativity.thread.event.GreenThreadEventorg.generalrelativity.thread.event.GreenThreadEvent.PROCESS_COMPLETEDispatched whenever a process has completed executing
| processTimeout | Event |
org.generalrelativity.thread.event.GreenThreadEventorg.generalrelativity.thread.event.GreenThreadEvent.PROCESS_TIMEOUTDispatched whenever a process has thrown a script timeout exception
| CYCLE | Constant |
public static const CYCLE:String = cycle| EPSILON | Constant |
public static const EPSILON:int = 1Minimum contribution- will have to tweak this based on testing