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

A base class for threaded jobs. More...

+ Inheritance diagram for Hydrogen.Threading.ThreadedJob:

Public Member Functions

override void Start (bool backgroundThread, System.Threading.ThreadPriority priority)
 Start the work process. This should initialize the Thread 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...
 

Protected Member Functions

override void Abort ()
 Abort the Job (as best we can). More...
 
- Protected Member Functions inherited from Hydrogen.Threading.JobBase
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

System.Threading.Thread Thread [get]
 System assigned thread. 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 threaded jobs.

Definition at line 34 of file ThreadedJob.cs.

Member Function Documentation

override void Hydrogen.Threading.ThreadedJob.Abort ( )
protectedvirtual

Abort the Job (as best we can).

Reimplemented from Hydrogen.Threading.JobBase.

Definition at line 73 of file ThreadedJob.cs.

74  {
75  _thread.Abort ();
76  base.Abort ();
77  }
override void Hydrogen.Threading.ThreadedJob.Start ( bool  backgroundThread,
System.Threading.ThreadPriority  priority 
)
virtual

Start the work process. This should initialize the Thread with the Run function.

Parameters
backgroundThreadIf set to true background thread.
priorityPriority.

Implements Hydrogen.Threading.JobBase.

Definition at line 55 of file ThreadedJob.cs.

56  {
57  // Create our new thread.
58  _thread = new System.Threading.Thread (Run);
59 
60  // Establish threads background.
61  _thread.IsBackground = backgroundThread;
62 
63  // Establish the threads priority.
64  _thread.Priority = priority;
65 
66  // Start working!
67  _thread.Start ();
68  }
virtual void Run(object state)
The launcher of the ThreadedFunction, used to handle the state as well.
Definition: JobBase.cs:153

Property Documentation

System.Threading.Thread Hydrogen.Threading.ThreadedJob.Thread
get

System assigned thread.

The job.

Definition at line 45 of file ThreadedJob.cs.