A* Pathfinding Project  3.8.5
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events Macros Groups Pages
WorkItemProcessor Class Reference

Classes

class  IndexedQueue< T >
 Similar to Queue<T> but allows random access. More...
 

Public Member Functions

 WorkItemProcessor (AstarPath astar)
 
void AddWorkItem (AstarWorkItem itm)
 Add a work item to be processed when pathfinding is paused.
 
void EnsureValidFloodFill ()
 If a WorkItem needs to have a valid flood fill during execution, call this method to ensure there are no pending flood fills.
 
void OnFloodFill ()
 
bool ProcessWorkItems (bool force)
 Process graph updating work items.
 
- Public Member Functions inherited from IWorkItemContext
void EnsureValidFloodFill ()
 If a WorkItem needs to have a valid flood fill during execution, call this method to ensure there are no pending flood fills.
 
void QueueFloodFill ()
 Call during work items to queue a flood fill.
 

Properties

bool workItemsInProgress [get, set]
 True while a batch of work items are being processed.
 

Private Member Functions

void IWorkItemContext. QueueFloodFill ()
 Call during work items to queue a flood fill.
 

Private Attributes

readonly AstarPath astar
 
bool queuedWorkItemFloodFill = false
 True if any work items have queued a flood fill.
 
readonly IndexedQueue
< AstarWorkItem
workItems = new IndexedQueue<AstarWorkItem>()
 
bool workItemsInProgressRightNow = false
 Used to prevent waiting for work items to complete inside other work items as that will cause the program to hang.
 

Constructor & Destructor Documentation

Member Function Documentation

void AddWorkItem ( AstarWorkItem  itm)

Add a work item to be processed when pathfinding is paused.

See Also
ProcessWorkItems
void EnsureValidFloodFill ( )

If a WorkItem needs to have a valid flood fill during execution, call this method to ensure there are no pending flood fills.

void OnFloodFill ( )
bool ProcessWorkItems ( bool  force)

Process graph updating work items.

Process all queued work items, e.g graph updates and the likes.

Returns
  • false if there are still items to be processed.
  • true if the last work items was processed and pathfinding threads are ready to be resumed.
See Also
AddWorkItem
threadSafeUpdateState
Update
void IWorkItemContext. QueueFloodFill ( )
private

Call during work items to queue a flood fill.

An instant flood fill can be done via FloodFill() but this method can be used to batch several updates into one to increase performance. WorkItems which require a valid Flood Fill in their execution can call EnsureValidFloodFill to ensure that a flood fill is done if any earlier work items queued one.

Once a flood fill is queued it will be done after all WorkItems have been executed.

Member Data Documentation

readonly AstarPath astar
private
bool queuedWorkItemFloodFill = false
private

True if any work items have queued a flood fill.

See Also
QueueWorkItemFloodFill
readonly IndexedQueue<AstarWorkItem> workItems = new IndexedQueue<AstarWorkItem>()
private
bool workItemsInProgressRightNow = false
private

Used to prevent waiting for work items to complete inside other work items as that will cause the program to hang.

Property Documentation

bool workItemsInProgress
getset

True while a batch of work items are being processed.

Set to true when a work item is started to be processed, reset to false when all work items are complete.

Work item updates are often spread out over several frames, this flag will be true during the whole time the updates are in progress.


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