AStar thread safe implementation