MCPcopy Create free account
hub / github.com/Kitware/CMake / take

Method take

Utilities/cmcppdap/src/chan.h:57–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55
56template <typename T>
57optional<T> Chan<T>::take() {
58 std::unique_lock<std::mutex> lock(mutex);
59 cv.wait(lock, [&] { return queue.size() > 0 || closed; });
60 if (queue.size() == 0) {
61 return optional<T>();
62 }
63 auto out = std::move(queue.front());
64 queue.pop();
65 return optional<T>(std::move(out));
66}
67
68template <typename T>
69void Chan<T>::put(T&& in) {

Callers 4

TEST_FFunction · 0.80
TESTFunction · 0.80
TESTFunction · 0.80

Calls 4

moveFunction · 0.85
waitMethod · 0.80
sizeMethod · 0.45
frontMethod · 0.45

Tested by 3

TEST_FFunction · 0.64
TESTFunction · 0.64
TESTFunction · 0.64