Get a shared lock on a semaphore. If the lock cannot be obtained immediately this function waits. There may be more than one shared locks at the same time but only one exclusive one. An exclusive lock prevents shared locks. Shared locks are released with ReleaseSemaphore().