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
LockFreeStack Class Reference

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

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.

On iOS it degrades to using locking since Interlocked.CompareExchange is not available on the iOS platform.

Todo:
Add SINGLE_THREAD_OPTIMIZE define

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
 

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.

Member Data Documentation

Path head

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