Torque 3D 3.8
ContentsIndexHome
PreviousUpNext
SFXThreadPool Members

The following tables list the members exposed by SFXThreadPool.

 
Name 
Description 
 
A ThreadPool context defines a logical context in which WorkItems are being executed. Their primary use is for biasing priorities of WorkItems.
Contexts are arranged in a tree hierarchy. Each parent node's priority bias scales all the priority biases underneath it.
Note that instances of this class are meant to be instantiated globally only. 
 
An action to execute on a worker thread from the pool.
Work items are concurrently reference-counted and will be automatically released once the last reference disappears. 
 
Name 
Description 
 
Name of this pool. Mainly for debugging. Used to name worker threads. 
 
Number of work items that have not yet completed execution. 
 
Number of worker threads spawned by the pool. 
 
Number of worker threads in non-sleeping state. 
 
Number of worker threads guaranteed to be non-blocking. 
 
Semaphore used to wake up threads, if necessary. 
 
List of worker threads. 
 
Threaded priority queue for concurrent access by worker threads. 
 
Force all work items to execute on main thread; turns this into a single-threaded system. Primarily useful to find whether malfunctions are caused by parallel execution or not. 
 
Work queue for main thread; can be used to ping back work items to main thread that need processing that can only happen on main thread. 
 
 
 
Name 
Description 
 
Create the singleton instance. @note Asserts when the singleton instance has already been constructed. 
 
Destroy the singleton instance. @note Asserts when no singleton has been constructed. 
 
For the global pool, it is very important to only ever call this function on the main thread and to let work items only ever come from the main thread. Otherwise this function has the potential of dead-locking as new work items may constantly be fed to the queue without it ever getting empty. @param timeOut Soft limit on the number of milliseconds to wait for the queue to flush out. -1 = infinite.
 
 
 
 
 
 
Return the priority increment applied to work items on each passing of the update interval. 
 
Return the interval in which item priorities are updated on the queue. @return update interval in milliseconds. 
 
 
Return the global thread pool singleton. 
 
Return the singleton instance. @note Asserts when called before createSingleton(). 
 
Return the singleton instance or NULL if it has been deleted or not yet constructed. 
 
Process work items waiting on the main thread's work queue.
There is a soft limit imposed on the time this method is allowed to run so as to balance frame-to-frame load. However, work items, once their processing is initiated, will not be suspended and will run for as long as they take to complete, so make sure individual items perform as little work as necessary.
@see ThreadPool::getMainThreadThesholdTimeMS
 
 
 
 
Add a work item to the main thread's work queue.
The main thread's work queue will be processed each frame using a set timeout to limit the work being done. Nonetheless, work items will not be suspended in-midst of processing, so make sure that whatever work you issue to the main thread is light work or you may see short hangs in gameplay.
To reiterate this: any code executed through this interface directly adds to frame processing time on the main thread.
This method *may* (and is meant to) be called from threads other than the main thread.
 
 
Set the priority increment applied to work items on each update interval. @param value Priority increment. Set to zero to deactivate. 
 
Set the update interval of the work item queue to the given value. @param milliSeconds Time between updates in milliseconds. 
 
Create a ThreadPool called "SFX" with two threads. 
 
Manually shutdown threads outside of static destructors.
 
 
If you're using a non-global thread pool to parallelise some work, you may want to block until all the parallel work is complete. As with flushWorkItems, this method may block indefinitely if new items keep getting added to the pool before old ones finish.This method will not wait for items queued on the main thread using queueWorkItemOnMainThread! @param timeOut Soft limit on the number of milliseconds to wait for all items to complete. -1 = infinite. 
Name 
Description 
This is nested type SFXInternal::SFXThreadPool::Parent. 
This is nested type ThreadPool::QueueType. 
This is nested type ThreadPool::WorkItemPtr. 
Copyright (c) 2015. All rights reserved.
What do you think about this topic? Send feedback!