Corrected the implemementation of the SingleSemaphore