Auto release for semaphore.