Optimize fiber's performance by decreasing the count of calling gettimeofday.

This commit is contained in:
zhengshuxin 2023-03-18 19:19:57 +08:00
parent 2bee91ca73
commit 389158b1a3

View File

@ -523,7 +523,11 @@ int event_process(EVENT *ev, int timeout)
// call the system event waiting API for any event arriving.
ret = ev->event_wait(ev, timeout);
(void) event_set_stamp(ev); // reset the stamp after event waiting.
// reset the stamp after event waiting only if timeout not 0 that
// we can decrease the times of calling gettimeofday() API.
if (timeout != 0) {
(void) event_set_stamp(ev);
}
#ifdef HAS_POLL
event_process_poll(ev);