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

Method corun

c/tests/pn_test_proactor.cpp:108–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108pn_event_type_t proactor::corun(proactor &other, pn_event_type_t stop) {
109 // We can't wait() on either proactor as it might be idle.
110 // We can't give up immediately if both proactors are idle
111 // something happens on the other, so spin between the two for a limited
112 // number of attempts that should be large enough if the test is going to
113 // pass.
114 int spin_limit = 1000;
115 do {
116 std::pair<int, pn_event_type_t> n_et = flush(stop);
117 if (n_et.second) return n_et.second;
118 if (n_et.first + other.flush().first == 0) {
119 // Both idle, sleep and retry in case network traffic is in flight.
120 millisleep(1);
121 --spin_limit;
122 }
123 } while (spin_limit);
124
125 return PN_EVENT_NONE;
126}
127
128pn_event_type_t proactor::wait_next() {
129 // pn_proactor_wait() should never return an empty batch, so we shouldn't need

Callers

nothing calls this directly

Calls 2

millisleepFunction · 0.85
flushMethod · 0.45

Tested by

no test coverage detected