MCPcopy Create free account
hub / github.com/apache/arrow / TryAcquire

Method TryAcquire

cpp/src/arrow/util/async_util.cc:47–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45 }
46
47 std::optional<Future<>> TryAcquire(int amt) override {
48 std::lock_guard<std::mutex> lk(mutex_);
49 if (backoff_.is_valid()) {
50 return backoff_;
51 }
52 if (amt <= available_cost_) {
53 available_cost_ -= amt;
54 return std::nullopt;
55 }
56 backoff_ = Future<>::Make();
57 return backoff_;
58 }
59
60 void Release(int amt) override {
61 std::unique_lock lk(mutex_);

Callers 2

AddTaskMethod · 0.45
ContinueTasksMethod · 0.45

Calls 2

MakeFunction · 0.70
is_validMethod · 0.45

Tested by

no test coverage detected