A* Pathfinding Project  3.1.4
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Enumerations Properties Groups Pages
LockFreeStack Class Reference

Implements a lock free multiple producer - single consumer stack for the Path object. More...

+ Collaboration diagram for LockFreeStack:

Public Member Functions

Path PopAll ()
 Pops all items from the stack and returns the head.
 
void Push (Path p)
 Pushes a path onto the stack.
 

Public Attributes

Path head
 

Detailed Description

Implements a lock free multiple producer - single consumer stack for the Path object.

Though it probably works for multiple producer - multiple consumer as well.

Todo:
Add SINGLE_THREAD_OPTIMIZE define

Member Function Documentation

Path PopAll ( )

Pops all items from the stack and returns the head.

To loop through all popped items, simple traverse the linked list starting with the head and continuing with item.next until item equals null

Path p = stack.PopAll ();
while (p != null) {
//Do something
p = p.next;
}
void Push ( Path  p)

Pushes a path onto the stack.

Will loop while trying to set the head of the stack to p.


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