AutoReleaser
- 已更新2025-07-21
- 閱讀時間為 1 分鐘
AutoReleaser
Use the AutoReleaser class to hold a reference with a lifetime that corresponds to a semaphore Acquire operation or a mutex Lock operation. When you release the final reference to the AutoReleaser object, one of the following operations complete:
- When the AutoReleaser is from the Semaphore.AcquireSemaphoreWithAutoReleaser method, a Release operation on the semaphore completes.
- When the AutoReleaser is from the Mutex.LockMutex method, an Unlock operation on the mutex completes.