TNet 3  3.0.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros
TNet.WorkerThread Class Reference

Worker thread is a convenience class that can execute specified code on a separate thread. The worker thread class takes care of creating multiple threads for concurrent code execution. More...

Inheritance diagram for TNet.WorkerThread:

Public Member Functions

delegate bool BoolFunc ()
 
delegate void VoidFunc ()
 

Static Public Member Functions

static void Abort ()
 Immediately abort all active threads. More...
 
static void Create (VoidFunc main, VoidFunc finished=null, bool highPriority=false)
 Add a new callback function to the worker thread. More...
 
static void CreateMultiStageCompletion (VoidFunc main, BoolFunc finished=null, bool highPriority=false)
 Add a new callback function to the worker thread. Return 'false' if you want the same delegate to execute again in the next Update(), or 'true' if you're done. More...
 
static void CreateMultiStageExecution (BoolFunc main, VoidFunc finished=null, bool highPriority=false)
 Add a new callback function to the worker thread. The 'main' delegate will run on a secondary thread, while the 'finished' delegate will run in Update(). Return 'false' if you want the same delegate to execute again next time, or 'true' if you're done. More...
 
static void CreateMultiStage (BoolFunc main, BoolFunc finished=null, bool highPriority=false)
 Add a new callback function to the worker thread. The 'main' delegate will run on a secondary thread, while the 'finished' delegate will run in Update(). Return 'false' if you want the same delegates to execute again next time, or 'true' if you're done. More...
 

Static Public Attributes

static long maxMillisecondsPerFrame = 4
 

Properties

static int remainingCallbackCount [get]
 Count how many callbacks are still remaining in the worker thread's queues. More...
 
static long currentExecutionTime [get]
 Number of elapsed milliseconds since the function started its current execution iteration. Only valid inside the OnFinished stage functions. More...
 
static long totalExecutionTime [get]
 Total execution time for the current callback, including secondary thread execution times. Execution of multi-stage callbacks are cumulative. Only valid inside the OnFinished stage functions. More...
 
static bool mainFrameTimeExceeded [get]
 Check from inside your multi-stage completion functions to check whether the main frame's max allowed time has been exceeded. Only valid inside the OnFinished stage functions. More...
 

Detailed Description

Worker thread is a convenience class that can execute specified code on a separate thread. The worker thread class takes care of creating multiple threads for concurrent code execution.

Member Function Documentation

static void TNet.WorkerThread.Abort ( )
static

Immediately abort all active threads.

delegate bool TNet.WorkerThread.BoolFunc ( )
static void TNet.WorkerThread.Create ( VoidFunc  main,
VoidFunc  finished = null,
bool  highPriority = false 
)
static

Add a new callback function to the worker thread.

static void TNet.WorkerThread.CreateMultiStage ( BoolFunc  main,
BoolFunc  finished = null,
bool  highPriority = false 
)
static

Add a new callback function to the worker thread. The 'main' delegate will run on a secondary thread, while the 'finished' delegate will run in Update(). Return 'false' if you want the same delegates to execute again next time, or 'true' if you're done.

static void TNet.WorkerThread.CreateMultiStageCompletion ( VoidFunc  main,
BoolFunc  finished = null,
bool  highPriority = false 
)
static

Add a new callback function to the worker thread. Return 'false' if you want the same delegate to execute again in the next Update(), or 'true' if you're done.

static void TNet.WorkerThread.CreateMultiStageExecution ( BoolFunc  main,
VoidFunc  finished = null,
bool  highPriority = false 
)
static

Add a new callback function to the worker thread. The 'main' delegate will run on a secondary thread, while the 'finished' delegate will run in Update(). Return 'false' if you want the same delegate to execute again next time, or 'true' if you're done.

delegate void TNet.WorkerThread.VoidFunc ( )

Member Data Documentation

long TNet.WorkerThread.maxMillisecondsPerFrame = 4
static

Property Documentation

long TNet.WorkerThread.currentExecutionTime
staticget

Number of elapsed milliseconds since the function started its current execution iteration. Only valid inside the OnFinished stage functions.

bool TNet.WorkerThread.mainFrameTimeExceeded
staticget

Check from inside your multi-stage completion functions to check whether the main frame's max allowed time has been exceeded. Only valid inside the OnFinished stage functions.

int TNet.WorkerThread.remainingCallbackCount
staticget

Count how many callbacks are still remaining in the worker thread's queues.

long TNet.WorkerThread.totalExecutionTime
staticget

Total execution time for the current callback, including secondary thread execution times. Execution of multi-stage callbacks are cumulative. Only valid inside the OnFinished stage functions.


The documentation for this class was generated from the following file: