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

Function with_lock

library/cpp/threading/future/async_semaphore.cpp:21–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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() {

Callers

nothing calls this directly

Calls 8

pop_frontMethod · 0.80
make_exception_ptrFunction · 0.50
swapFunction · 0.50
push_backMethod · 0.45
GetFutureMethod · 0.45
emptyMethod · 0.45
frontMethod · 0.45

Tested by

no test coverage detected