Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

SemaphoreGet/Release


ryan42 Nov 19, 2019 12:03 AM

Hi,

I am having a few issues with Semaphores. I have a function setPort(port,state) that uses a Case Select to control a port as the built in PortSet() does not allow for a variable port. It just selects the port I actually want and sets it to the desired state.

The problem occurs when getting the semaphore or calling the function, and always at the same point even though it is called from multiple places throughout the program in multiple scans as below. 

SemaphoreGet(portSemaphore)
  setPort(selectedModemPowerPort,selectedModemOnState)
SemaphoreRelease(portSemaphore)

This function has been used unchanged for years, the only difference is that I have added the semaphores and started calling it from other scans. The program runs in sequential mode. I can see the program get the semaphore but it is never released and this in turn holds up the program... portSemaphore is 2, I have another one linked to 1.

I am using this to avoid calling the function from two places in the program at once as this has caused me issues in the past locking up the logger. This is also being done on a CR300, CR850 and CR1000.

Any heap would be greatly appreciated.

Cheers
Ryan

Log in or register to post/reply in the forum.