MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Acquire

Method Acquire

tensorflow/compiler/xla/python/semaphore.cc:30–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30void Semaphore::Acquire(int64 amount) {
31 CHECK_GE(amount, 0);
32
33 CanAcquireArgs args;
34 args.semaphore = this;
35 args.amount = amount;
36
37 mu_.LockWhen(absl::Condition(&CanAcquire, &args));
38 value_ -= amount;
39 mu_.Unlock();
40}
41
42void Semaphore::Release(int64 amount) {
43 CHECK_GE(amount, 0);

Callers 2

TESTFunction · 0.45
ExecuteOnLocalDevicesMethod · 0.45

Calls 2

ConditionClass · 0.85
UnlockMethod · 0.80

Tested by 1

TESTFunction · 0.36