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

Method put

include/process/queue.hpp:35–54  ·  view source on GitHub ↗

TODO(bmahler): Take a T&& here instead.

Source from the content-addressed store, hash-verified

33
34 // TODO(bmahler): Take a T&& here instead.
35 void put(const T& t)
36 {
37 // NOTE: We need to grab the promise 'date->promises.front()' but
38 // set it outside of the critical section because setting it might
39 // trigger callbacks that try to reacquire the lock.
40 Owned<Promise<T>> promise;
41
42 synchronized (data->lock) {
43 if (data->promises.empty()) {
44 data->elements.push(t);
45 } else {
46 promise = data->promises.front();
47 data->promises.pop_front();
48 }
49 }
50
51 if (promise.get() != nullptr) {
52 promise->set(t);
53 }
54 }
55
56 Future<T> get()
57 {

Callers 9

foreachFunction · 0.80
serveFunction · 0.80
runMethod · 0.80
reapMethod · 0.80
listenMethod · 0.80
accept_callbackMethod · 0.80
TESTFunction · 0.80
TEST_PFunction · 0.80
TESTFunction · 0.80

Calls 5

pushMethod · 0.80
synchronizedFunction · 0.50
emptyMethod · 0.45
getMethod · 0.45
setMethod · 0.45

Tested by 3

TESTFunction · 0.64
TEST_PFunction · 0.64
TESTFunction · 0.64