Hydrogen Framework  1.3.1
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
Hydrogen.Threading.ThreadPoolJob Class Reference

A base class for ThreadPool jobs. More...

+ Inheritance diagram for Hydrogen.Threading.ThreadPoolJob:

Public Member Functions

override void Start (bool backgroundThread, System.Threading.ThreadPriority priority)
 Sends the work process to the ThreadPool for starting when resources are available, This needs to initialize the WaitCallback with the Run function. More...
 
- Public Member Functions inherited from Hydrogen.Threading.JobBase
virtual bool Check ()
 Checks if the Job is done, and facilitates calling OnFinished when completed. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Hydrogen.Threading.JobBase
virtual void Abort ()
 Abort the Job (as best we can). More...
 
virtual void OnFinished ()
 Called once by Check when the Job has finished. More...
 
virtual void Run (object state)
 The launcher of the ThreadedFunction, used to handle the state as well. More...
 
virtual void ThreadedFunction ()
 The work horse function that MUST BE THREAD SAFE. Do not touch the Unity API! It will cause an exception if you do, and things will act like a 4 year old having a tantrum. Debugging should be handled via System.Console and you should be aware that exceptions will not show up in Unity if they happen on the thread; therefore you will never know if its broken so test your code outside of the threading first, or have copius amounts of debugging implemented. More...
 
- Properties inherited from Hydrogen.Threading.JobBase
bool IsBusy [get, set]
 Is the Job busy working? More...
 
bool IsDone [get, set]
 Is the Job done? More...
 
bool FiredOnFinished [get, set]
 Has the OnFinished been called yet? More...
 

Detailed Description

A base class for ThreadPool jobs.

Definition at line 34 of file ThreadPoolJob.cs.

Member Function Documentation

override void Hydrogen.Threading.ThreadPoolJob.Start ( bool  backgroundThread,
System.Threading.ThreadPriority  priority 
)
virtual

Sends the work process to the ThreadPool for starting when resources are available, This needs to initialize the WaitCallback with the Run function.

Parameters
backgroundThreadNot Used.
priorityNot Used.

Implements Hydrogen.Threading.JobBase.

Definition at line 47 of file ThreadPoolJob.cs.

48  {
49  _callback = new System.Threading.WaitCallback (Run);
50  System.Threading.ThreadPool.QueueUserWorkItem (_callback);
51  }
virtual void Run(object state)
The launcher of the ThreadedFunction, used to handle the state as well.
Definition: JobBase.cs:153