In the current implementation you have a possible race condition, if a thread switch occurs between checking the s_semaphoresLockedCount and incrementing it.  Semaphores are already counting, will it be possible to use them?