changing the handling of the way we block and unblock semaphores