MCPcopy Create free account
hub / github.com/3rdparty/libprocess / unlock

Method unlock

include/process/mutex.hpp:50–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48 }
49
50 void unlock()
51 {
52 // NOTE: We need to grab the promise 'date->promises.front()' but
53 // set it outside of the critical section because setting it might
54 // trigger callbacks that try to reacquire the lock.
55 Option<Promise<Nothing>> waiter;
56
57 synchronized (data->lock) {
58 if (!data->waiters.empty()) {
59 // TODO(benh): Skip a future that has been discarded?
60 waiter = std::move(data->waiters.front());
61 data->waiters.pop();
62 } else {
63 data->locked = false;
64 }
65 }
66
67 if (waiter.isSome()) {
68 waiter->set(Nothing());
69 }
70 }
71
72private:
73 struct Data

Callers 3

locking_functionFunction · 0.80
dyn_lock_functionFunction · 0.80
TESTFunction · 0.80

Calls 3

synchronizedFunction · 0.50
emptyMethod · 0.45
setMethod · 0.45

Tested by 1

TESTFunction · 0.64