I have a queue that is being read by a single chart using FIFO and after each read it shifts the queue by -1 to remove the top item.
I also have subroutine that writes to this queue and this subroutine can be called from multiple charts.
I want to:
- Pass a Flag variable to the subroutine (or really a pointer to a Flag variable because I’m afraid the subroutine wont lock the flag otherwise)
- Then lock the Flag using blocking (-1)
- Write to end of queue
- Then unlock the Flag
Do charts that call a subroutine pause until the subroutine finishes?
If the subroutine tries to lock the Flag but finds it already locked, will it immediately delay the subroutine to try again in XX ms? or will it spike the CPU trying over and over to lock the Flag for up to 1ms before its forced to move on to the next chart?
I can’t find any reference to how often the FlagLock() command will attempt to lock a locked Flag and if FlagLock() only tries once before delaying the current chart/subroutine.