MCPcopy Create free account
hub / github.com/apache/mesos / write_lock

Method write_lock

3rdparty/libprocess/include/process/rwlock.hpp:44–59  ·  view source on GitHub ↗

TODO(bmahler): Consider returning a 'Locked' object in the future as the mechanism for unlocking, rather than exposing unlocking functions for all to call.

Source from the content-addressed store, hash-verified

42 // future as the mechanism for unlocking, rather than exposing
43 // unlocking functions for all to call.
44 Future<Nothing> write_lock()
45 {
46 Future<Nothing> future = Nothing();
47
48 synchronized (data->lock) {
49 if (!data->write_locked && data->read_locked == 0u) {
50 data->write_locked = true;
51 } else {
52 Waiter w{Waiter::WRITE};
53 future = w.promise.future();
54 data->waiters.push(std::move(w));
55 }
56 }
57
58 return future;
59 }
60
61 void write_unlock()
62 {

Callers 2

TESTFunction · 0.80
pruneImagesMethod · 0.80

Calls 4

NothingClass · 0.85
pushMethod · 0.80
synchronizedFunction · 0.50
futureMethod · 0.45

Tested by 1

TESTFunction · 0.64