struct timeval tv; int res, done;   if (evsel->recalc(evbase, 0) == -1) return (-1);  done = 0; while (!done) {  if (event_gotterm) { event_gotterm = 0; break; }  while (event_gotsig) { event_gotsig = 0; if (event_sigcb) { res = (*event_sigcb)(); if (res == -1) { errno = EINTR; return (-1); } } }   gettimeofday(&tv, NULL); if (timercmp(&tv, &event_tv, <)) { struct timeval off; LOG_DBG((LOG_MISC, 10, "%s: time is running backwards, corrected", __func__));  timersub(&event_tv, &tv, &off); timeout_correct(&off); } event_tv = tv;  if (!(flags & EVLOOP_NONBLOCK)) timeout_next(&tv); else timerclear(&tv);   if (!event_haveevents()) return (1);  res = evsel->dispatch(evbase, &tv);  if (res == -1) return (-1);  timeout_process();  if (TAILQ_FIRST(&activequeue)) { event_process_active(); if (flags & EVLOOP_ONCE) done = 1; } else if (flags & EVLOOP_NONBLOCK) done = 1;  if (evsel->recalc(evbase, 0) == -1) return (-1); }  return (0);
return event_base_loop(current_base, flags);
event_loop(int flags){	struct timeval tv;	int res, done;	/* Calculate the initial events that we are waiting for */	if (evsel->recalc(evbase, 0) == -1)		return (-1);	done = 0;	while (!done) {		/* Terminate the loop if we have been asked to */		if (event_gotterm) {			event_gotterm = 0;			break;		}		while (event_gotsig) {			event_gotsig = 0;			if (event_sigcb) {				res = (*event_sigcb)();				if (res == -1) {					errno = EINTR;					return (-1);				}			}		}		/* Check if time is running backwards */		gettimeofday(&tv, NULL);		if (timercmp(&tv, &event_tv, <)) {			struct timeval off;			LOG_DBG((LOG_MISC, 10,				    "%s: time is running backwards, corrected",				    __func__));			timersub(&event_tv, &tv, &off);			timeout_correct(&off);		}		event_tv = tv;		if (!(flags & EVLOOP_NONBLOCK))			timeout_next(&tv);		else			timerclear(&tv);				/* If we have no events, we just exit */		if (!event_haveevents())			return (1);		res = evsel->dispatch(evbase, &tv);		if (res == -1)			return (-1);		timeout_process();		if (TAILQ_FIRST(&activequeue)) {			event_process_active();			if (flags & EVLOOP_ONCE)				done = 1;		} else if (flags & EVLOOP_NONBLOCK)			done = 1;		if (evsel->recalc(evbase, 0) == -1)			return (-1);	}	return (0);}