MCPcopy Create free account
hub / github.com/apache/qpid-proton / receive

Method receive

cpp/examples/multithreaded_client_flow_control.cpp:175–188  ·  view source on GitHub ↗

Thread safe receive

Source from the content-addressed store, hash-verified

173
174 // Thread safe receive
175 proton::message receive() {
176 std::unique_lock<std::mutex> l(lock_);
177 // Wait for buffered messages
178 while (!closed_ && (!work_queue_ || buffer_.empty())) {
179 can_receive_.wait(l);
180 }
181 if (closed_) throw closed("receiver closed");
182 proton::message m = std::move(buffer_.front());
183 buffer_.pop();
184 // Add a lambda to the work queue to call receive_done().
185 // This will tell the handler to add more credit.
186 work_queue_->add([=]() { this->receive_done(); });
187 return m;
188 }
189
190 // Thread safe
191 void close() {

Callers 1

receive_threadFunction · 0.45

Calls 6

receive_doneMethod · 0.95
closedClass · 0.70
waitMethod · 0.65
emptyMethod · 0.45
popMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected