For
231beb2c234914f942166eb152c44e55b5b01f86 I tested incorrectly, using
Task Manager inside the VM which reports low CPU load even when spinning.
DP's `status` command showed the correct result.
Changes the default path from select() to: usleep() on POSIX, Sleep() on
Windows.
Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
else if(sys_supportsdlgetticks && sys_usesdldelay.integer)
Sys_SDL_Delay(microseconds / 1000);
#if HAVE_SELECT
else if(sys_supportsdlgetticks && sys_usesdldelay.integer)
Sys_SDL_Delay(microseconds / 1000);
#if HAVE_SELECT
+ else if (cls.state == ca_dedicated && sv_checkforpacketsduringsleep.integer)
{
struct timeval tv;
lhnetsocket_t *s;
{
struct timeval tv;
lhnetsocket_t *s;
int lastfd = -1;
FD_ZERO(&fdreadset);
int lastfd = -1;
FD_ZERO(&fdreadset);
- if (cls.state == ca_dedicated && sv_checkforpacketsduringsleep.integer)
+ List_For_Each_Entry(s, &lhnet_socketlist.list, lhnetsocket_t, list)
- List_For_Each_Entry(s, &lhnet_socketlist.list, lhnetsocket_t, list)
+ if (s->address.addresstype == LHNETADDRESSTYPE_INET4 || s->address.addresstype == LHNETADDRESSTYPE_INET6)
- if (s->address.addresstype == LHNETADDRESSTYPE_INET4 || s->address.addresstype == LHNETADDRESSTYPE_INET6)
- {
- if (lastfd < s->inetsocket)
- lastfd = s->inetsocket;
+ if (lastfd < s->inetsocket)
+ lastfd = s->inetsocket;
#if defined(WIN32) && !defined(_MSC_VER)
#if defined(WIN32) && !defined(_MSC_VER)
- FD_SET((int)s->inetsocket, &fdreadset);
+ FD_SET((int)s->inetsocket, &fdreadset);
- FD_SET((unsigned int)s->inetsocket, &fdreadset);
+ FD_SET((unsigned int)s->inetsocket, &fdreadset);
}
}
tv.tv_sec = microseconds / 1000000;
tv.tv_usec = microseconds % 1000000;
// on Win32, select() cannot be used with all three FD list args being NULL according to MSDN
}
}
tv.tv_sec = microseconds / 1000000;
tv.tv_usec = microseconds % 1000000;
// on Win32, select() cannot be used with all three FD list args being NULL according to MSDN
- // (so much for POSIX...)
- // bones_was_here: but a zeroed fd_set seems to be tolerated (tested on Win 7)
+ // (so much for POSIX...), not with an empty fd_set either.
select(lastfd + 1, &fdreadset, NULL, NULL, &tv);
}
select(lastfd + 1, &fdreadset, NULL, NULL, &tv);
}
else
usleep(microseconds);
#elif HAVE_Sleep
else
usleep(microseconds);
#elif HAVE_Sleep