Only allow the semaphore to be taken when the value is positive. Don't decrement it twice when it is taken.
Only allow the semaphore to be taken when the value is positive.
Don't decrement it twice when it is taken.

Reported by:	kris

jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase