Rework the g_poll() implementation on Windows to match poll() semantics