Multithreading lock with pathfinding/graphupdate

I’ve been investigating a random freeze bug in the game I’m working on for the past few days and I’m pretty sure it’s a deadlock caused by the pathfinding code. When I encounter the freeze and Break All on my debugger, this is the parallel stack. Two of the threads it’s stuck in are lines in pathfinding code that have (potentially) infinite waits in them. I’m pretty new to multithreading so forgive my ignorance, but it seems like a the head variable is null going into the ThreadControlQueue.Pop() function causing it to call Starve() and block execution. I don’t know if this is the intended behaviour and something else has gone wrong elsewhere but it’s a major issue for us and release is very soon.

ThreadControlQueue.Pop()

The pathfinding threads will block if they have nothing to do. They become starving when there’s nothing for them to “eat” (work). They will wake up when necessary.