1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 21:40:33 +02:00

scm_accept no longer leaves guile mode

* libguile/socket.c (scm_accept): Revert
  7d1fc87217. Now that we don't need to
  leave guile mode in order for GC to happen, don't do so, as we assume
  that anyone who cares has already done a select() beforehand.
This commit is contained in:
Andy Wingo 2010-12-02 23:24:39 +01:00
parent 6901bad07d
commit e68e0369cc

View file

@ -38,8 +38,6 @@
#include "libguile/validate.h" #include "libguile/validate.h"
#include "libguile/socket.h" #include "libguile/socket.h"
#include "libguile/iselect.h"
#ifdef __MINGW32__ #ifdef __MINGW32__
#include "win32-socket.h" #include "win32-socket.h"
#endif #endif
@ -1285,30 +1283,16 @@ SCM_DEFINE (scm_accept, "accept", 1, 0, 0,
"connection and will continue to accept new requests.") "connection and will continue to accept new requests.")
#define FUNC_NAME s_scm_accept #define FUNC_NAME s_scm_accept
{ {
int fd, selected; int fd;
int newfd; int newfd;
SCM address; SCM address;
SCM newsock; SCM newsock;
SELECT_TYPE readfds, exceptfds;
socklen_t addr_size = MAX_ADDR_SIZE; socklen_t addr_size = MAX_ADDR_SIZE;
scm_t_max_sockaddr addr; scm_t_max_sockaddr addr;
sock = SCM_COERCE_OUTPORT (sock); sock = SCM_COERCE_OUTPORT (sock);
SCM_VALIDATE_OPFPORT (1, sock); SCM_VALIDATE_OPFPORT (1, sock);
fd = SCM_FPORT_FDES (sock); fd = SCM_FPORT_FDES (sock);
FD_ZERO (&readfds);
FD_ZERO (&exceptfds);
FD_SET (fd, &readfds);
FD_SET (fd, &exceptfds);
/* Block until something happens on FD, leaving guile mode while
waiting. */
selected = scm_std_select (fd + 1, &readfds, NULL, &exceptfds,
NULL);
if (selected < 0)
SCM_SYSERROR;
newfd = accept (fd, (struct sockaddr *) &addr, &addr_size); newfd = accept (fd, (struct sockaddr *) &addr, &addr_size);
if (newfd == -1) if (newfd == -1)
SCM_SYSERROR; SCM_SYSERROR;