[Twisted-Python] No-op TimerService on Windows?

Andrew Bennetts andrew-twisted at puzzling.org
Thu May 4 21:51:47 EDT 2006


On Thu, May 04, 2006 at 05:39:22PM +0200, Eric Faurot wrote:
> On 5/4/06, glyph at divmod.com <glyph at divmod.com> wrote:
> 
[...]
> >
> >There should be a comment or something to this effect, but:
> >
> >On Windows, the "signal" handling that Control-c triggers doesn't actually 
> >interrupt select().  That timer is there to keep the timeout low so that 
> >the server responds in a timely fashion when the user hits Control-c on 
> >the console, even if nothing else is happening.
> 
> Ok, but as far as I can see, it is redundant with way select is
> wrapped on win32 (in selectreactor). BTW, I am not windows-savvy, but
> are the arguments to select (r,w,w) really correct? not (r,w,e)?

You're right, this does seem to take care of that problem.  I'm not sure what
benefit the extra code to do this in twistw adds.

As far as (r,w,w) goes, yes, it is correct -- again, there ought to be a comment
about this.  select on windows is subtly incompatible with select on POSIX, and
uses the third fd set to check for connection failures and the like, whereas on
POSIX this is just signalled on the first or second fd set.  I forget the
precise details, but luckily Itamar has recorded them here: 

    http://itamarst.org/writings/win32sockets.html

So our win32select wrapper passes the write list as the exception list too, then
returns (r, w + e, []) -- so the wrapper behaves more like POSIX, as the
SelectReactor expects.

-Andrew.





More information about the Twisted-Python mailing list