Esempio n. 1
0
/* Process events on a proactor array until a handler returns an event, or
 * all proactors return NULL
 */
static pn_event_type_t test_proactors_get(test_proactor_t *tps, size_t n) {
  if (last_condition) pn_condition_clear(last_condition);
  while (true) {
    bool busy = false;
    for (test_proactor_t *tp = tps; tp < tps + n; ++tp) {
      pn_event_batch_t *eb =  pn_proactor_get(tp->proactor);
      if (eb) {
        busy = true;
        pn_event_type_t ret = PN_EVENT_NONE;
        for (pn_event_t* e = pn_event_batch_next(eb); e; e = pn_event_batch_next(eb)) {
          test_handler_log(&tp->handler, e);
          save_condition(e);
          ret = tp->handler.f(&tp->handler, e);
          if (ret) break;
        }
        pn_proactor_done(tp->proactor, eb);
        if (ret) return ret;
      }
    }
    if (!busy) {
      return PN_EVENT_NONE;
    }
  }
}
Esempio n. 2
0
void Condition::save(FILE* file){
	fprintf(file,"do and=%d\n",do_and);
	save_condition(file);
}