[Top][All Lists]

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

Re: [Chicken-hackers] [PATCH] Avoid context switch during TCP errno repo

From: Peter Bex
Subject: Re: [Chicken-hackers] [PATCH] Avoid context switch during TCP errno reporting
Date: Thu, 18 Apr 2013 00:37:53 +0200
User-agent: Mutt/

On Wed, Mar 27, 2013 at 10:18:48PM +0100, Peter Bex wrote:
> On Tue, Mar 26, 2013 at 08:30:23PM -0400, John Cowan wrote:
> > > However, posixwindows doesn't have an implementation for file-select
> > > at all, while select() certainly is available on Windows (the scheduler
> > > uses it too, after all!).
> > 
> > IIRC, the trouble with select() on Windows is that it has nothing to say
> > about fds that are associated with non-sockets, and indeed Cygwin jumps
> > through enormous hoops to make its use seamless.
> Thanks for the heads up, I wasn't able to find any info on this.
> This means the bit where I moved some stuff into C_check_fd_ready() is
> not going to work, and still requires duplication in tcp.scm

Sorry for posting this so late, but here goes, attached is a new version
of this patch (split in three, for convenience).

I restored the C_NONUNIX check in C_char_ready_p so that it will
return #t under Windows in all cases.  (BTW: I think this name should
probably be changed to C_WINDOWS or something; e.g. Haiku isn't really
UNIX either yet it doesn't define C_NONUNIX)

I've also decided to reimplement file-select in terms of poll(), since
it's defined in posixunix.scm and all our supported UNIX variants have
defined HAVE_POSIX_POLL anyway.  There are still some issues with
file-select, but none of them are new:

- It blocks the entire process
- It doesn't handle waiting for read/write on the same FD  (it will return
   all in the second list, but that's AFAIK undefined - it may just return
   all in the first or in both lists, depending on kernel & libc in use)
- It's a pretty huge and ugly procedure

I also found a bug in its type declaration; it didn't allow for plain
fixnums or #f to be passed as either fd list.  I'd be a lot happier if
we'd just deprecate file-select altogether and maybe move it to an egg.

It would be nice if someone could verify this works on Windows.


Attachment: 0001-Replace-select-by-poll-when-available-in-char-ready-.patch
Description: Text document

Attachment: 0002-Fix-types-database-entry-for-file-select-to-allow-fo.patch
Description: Text document

Attachment: 0003-Implement-file-select-in-terms-of-POSIX-poll-for-UNI.patch
Description: Text document

reply via email to

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