| 51 | } |
| 52 | |
| 53 | void TAsyncSemaphore::Cancel() { |
| 54 | std::list<TPromise<TPtr>> promises; |
| 55 | with_lock(Lock_) { |
| 56 | Cancelled_ = true; |
| 57 | std::swap(Promises_, promises); |
| 58 | } |
| 59 | for (auto& p: promises) { |
| 60 | p.SetException(std::make_exception_ptr(TOperationCancelledException())); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | TAsyncSemaphore::TAutoRelease::~TAutoRelease() { |
| 65 | if (Sem) { |
no test coverage detected