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

Method TryAcquire

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

Source from the content-addressed store, hash-verified

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