guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] nonblocking write/recv/send/connect/accept


From: Marius Vollmer
Subject: Re: [PATCH] nonblocking write/recv/send/connect/accept
Date: 01 Jun 2002 17:58:29 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Christopher Cramer <address@hidden> writes:

> Here it is. scm_connect was a little tricky and it actually looks very
> ugly to me, but the connect system call was really not designed for this
> sort of thing =^(.

Right, I have to trust you that it works :-)

The patch contains a lot of code of the form

      {
        int n;
        SELECT_TYPE writefds;
        int flags = fcntl (fd, F_GETFL);

        if (flags == -1)
          scm_syserror ("fport_flush");
        if (!(flags & O_NONBLOCK))
          {
            do
              {
                FD_ZERO (&writefds);
                FD_SET (fd, &writefds);
                n = scm_internal_select (fd + 1, NULL, &writefds, NULL, NULL);
              }
            while (n == -1 && errno == EINTR);
            if (n == -1) scm_syserror ("fport_flush");
          }
      }

Could you try to collect this pattern into its own set of functions
(ala fport_wait_for_input)?  I think this will make the code much
cleaner.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]