/* * Run dispatcher <dis>. Returns 0 if there were no more timers or files to wait for, or -1 in case * of an error. */ int disRun(Dispatcher *dis) { int r; do { r = disHandleEvents(dis); P fprintf(stderr, "disHandleEvents returned %d\n", r); } while (r == 0); return r == 1 ? 0 : r; }
/* * Wait for file or timer events and handle them. This function returns 1 if there are no files or * timers to wait for, -1 if some error occurred, or 0 if any number of events was successfully * handled. */ int nsHandleEvents(NS *ns) { return disHandleEvents(&ns->dis); }