MCPcopy Create free account
hub / github.com/catboost/catboost / AcquireAsync

Method AcquireAsync

library/cpp/threading/future/async_semaphore.cpp:20–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18}
19
20TFuture<TAsyncSemaphore::TPtr> TAsyncSemaphore::AcquireAsync() {
21 with_lock(Lock_) {
22 if (Cancelled_) {
23 return MakeErrorFuture<TPtr>(
24 std::make_exception_ptr(TOperationCancelledException()));
25 }
26 if (Count_) {
27 --Count_;
28 return MakeFuture<TAsyncSemaphore::TPtr>(this);
29 }
30 auto promise = NewPromise<TAsyncSemaphore::TPtr>();
31 Promises_.push_back(promise);
32 return promise.GetFuture();
33 }
34}
35
36void TAsyncSemaphore::Release() {
37 TPromise<TPtr> promise;

Callers 1

Y_UNIT_TESTFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected