I am using a wait block to make agents wait until a condition is true (a resource is idle). I have tried writing the following in the wait blocks "on enter" field:
if(resourcePool1.idle()> 0){ self.free(agent); }
The problem is that if the resource becomes busy the agent will be trapped inside the wait block and will not be released, even if the condition becomes true again. Then when the next agent enters the wait block (and the condition has become true again) it will pass the agent that was otherwise in front of it, but that is now stuck. Is there a way to fix this?