Méthode | Description | |
---|---|---|
AddTask ( TaskFunction function, TaskComplete completion, TaskContext ctx ) : System.Threading.Task |
Add a task to the thread queue. When a thread is available, it will dequeue this task and run it. Once complete, the task will be marked complete, but your application won't be called back until the next time Update() is called (so that callbacks are from the main thread).
|
|
DeliverComplete ( ) : void |
Deliver all complete tasks. This is usually called for you, but can be called by you if you know that some tasks have completed.
|
|
NewTaskContext ( ) : TaskContext | ||
ThreadPoolComponent ( Microsoft.Xna.Framework.Game game ) : System |
Create the ThreadPoolComponent in your application constructor, and add it to your Components collection. The ThreadPool will deliver any completed tasks first in the update order. On Xbox, creates 3 threads. On PC, creates one or more threads, depending on the number of CPU cores. Always creates at least one thread. The thread tasks are assumed to be computationally expensive, so more threads than there are CPU cores is not recommended.
|
|
Update ( |
Méthode | Description | |
---|---|---|
Dispose ( bool disposing ) : void |
Disposing the ParallelThreadPool component will immediately deliver all work items with an object disposed exception.
|
Méthode | Description | |
---|---|---|
NewWorker ( TaskFunction tf, TaskComplete tc ) : Worker | ||
Reclaim ( TaskContext ctx ) : void | ||
ThreadFunc ( ) : void | ||
WorkOne ( ) : void |
public AddTask ( TaskFunction function, TaskComplete completion, TaskContext ctx ) : System.Threading.Task | ||
function | TaskFunction | The function to call within the thread. |
completion | TaskComplete | The callback to report results to, or null. If /// you care about which particular task has completed, use a different instance /// for this delegate per task (typically, a delegate on the task itself). |
ctx | TaskContext | A previously allocated TaskContext, to allow for waiting /// on the task, or null. It cannot have been already used. |
Résultat | System.Threading.Task |
protected Dispose ( bool disposing ) : void | ||
disposing | bool | |
Résultat | void |
public ThreadPoolComponent ( Microsoft.Xna.Framework.Game game ) : System | ||
game | Microsoft.Xna.Framework.Game | Your game instance. |
Résultat | System |
public Update ( |
||
gameTime | ||
Résultat | void |