Fixed semaphore handling code that was mistakingly removed from port (pointed out...