| 106 | } |
| 107 | |
| 108 | pn_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 | |
| 128 | pn_event_type_t proactor::wait_next() { |
| 129 | // pn_proactor_wait() should never return an empty batch, so we shouldn't need |
nothing calls this directly
no test coverage detected