(Netplay) Create wrapper function for select()

This commit is contained in:
twinaphex 2015-01-23 11:44:13 +01:00
parent cec500ece5
commit f6d0a80b3d
4 changed files with 16 additions and 6 deletions

View File

@ -336,7 +336,7 @@ static void network_cmd_poll(rarch_cmd_t *handle)
FD_ZERO(&fds);
FD_SET(handle->net_fd, &fds);
if (select(handle->net_fd + 1, &fds, NULL, NULL, &tmp_tv) <= 0)
if (socket_select(handle->net_fd + 1, &fds, NULL, NULL, &tmp_tv) <= 0)
return;
if (!FD_ISSET(handle->net_fd, &fds))

View File

@ -348,7 +348,7 @@ static int poll_input(netplay_t *netplay, bool block)
FD_SET(netplay->udp_fd, &fds);
FD_SET(netplay->fd, &fds);
if (select(max_fd, &fds, NULL, NULL, &tmp_tv) < 0)
if (socket_select(max_fd, &fds, NULL, NULL, &tmp_tv) < 0)
return -1;
/* Somewhat hacky,
@ -1485,7 +1485,7 @@ static void netplay_pre_frame_spectate(netplay_t *netplay)
FD_ZERO(&fds);
FD_SET(netplay->fd, &fds);
if (select(netplay->fd + 1, &fds, NULL, NULL, &tmp_tv) <= 0)
if (socket_select(netplay->fd + 1, &fds, NULL, NULL, &tmp_tv) <= 0)
return;
if (!FD_ISSET(netplay->fd, &fds))

View File

@ -110,3 +110,13 @@ int socket_close(int fd)
return close(fd);
#endif
}
int socket_select(int nfds, fd_set *readfs, fd_set *writefds,
fd_set *errorfds, struct timeval *timeout)
{
#if defined(__CELLOS_LV2__)
return socketselect(nfds, readfs, writefds, errorfds, timeout);
#else
return select(nfds, readfs, writefds, errorfds, timeout);
#endif
}

View File

@ -81,9 +81,6 @@
#include <sys/time.h>
#include <unistd.h>
#if defined(__CELLOS_LV2__)
#define select(nfds, readfds, writefds, errorfds, timeout) socketselect(nfds, readfds, writefds, errorfds, timeout)
#endif
#endif
/* Compatibility layer for legacy or incomplete BSD socket implementations.
@ -125,5 +122,8 @@ bool socket_nonblock(int fd);
int socket_close(int fd);
int socket_select(int nfds, fd_set *readfs, fd_set *writefds,
fd_set *errorfds, struct timeval *timeout);
#endif