change ev_poll() to accept a wait parameter