pub async fn get_semaphore( semaphore: &Arc<Semaphore>, detect: bool, ) -> &Arc<Semaphore>
Return the semaphore that should be used.