
static void* broker_thread(void *void_broker) {
  broker_t *b = (broker_t*)void_broker;
  bool finished = false;
  do {
    pn_event_batch_t *events = pn_proactor_wait(b->proactor);
    pn_event_t *e;
    while ((e = pn_event_batch_next(events))) {
        if (!handle(b, e)) finished = true;
    }
    pn_proactor_done(b->proactor, events);
  } while(!finished);
  return NULL;

static void* broker_thread(void *void_broker) {
  broker_t *b = (broker_t*)void_broker;
  bool finished = false;
  do {
    pn_event_batch_t *events = pn_proactor_wait(b->proactor);
    pn_event_t *e;
    while ((e = pn_event_batch_next(events))) {
        if (!handle(b, e)) finished = true;
    }
    pn_proactor_done(b->proactor, events);
  } while(!finished);
  return NULL;