stolk / GPGOAP

General Purpose Goal Oriented Action Planning
558 stars 63 forks source link

astar.c functions are not thread safe #4

Closed metiscus closed 8 years ago

metiscus commented 9 years ago

Due to the use of global data the goap library can only be called by a single thread.

static astarnode_t opened[ MAXOPEN ]; //!< The set of nodes we should consider. static astarnode_t closed[ MAXCLOS ]; //!< The set of nodes we already visited.

static int numOpened = 0; //!< The nr of nodes in our opened set. static int numClosed = 0; //!< The nr of nodes in our closed set.

If these were added to a struct that was passed in to the various functions, it would provide thread safety.