Fixed intermittently failing test. The test failed because it assumed that the threads obtained the semaphore in the order they were started which is not necessarily true.