On 5/4/06, glyph@divmod.com
On Thu, 4 May 2006 11:05:21 +0200, Eric Faurot
wrote: In the process of exploring my options for deploying twisted applications on Windows, I noticed that when running the application, _twistw (line 43) also starts a TimerService around a no-op:
app.startApplication(internet.TimerService(0.1, lambda:None), 0)
I suppose there is very good reason to do so, but I do not see it. Can somebody enlighten me?
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)? def win32select(r, w, e, timeout=None): """Win32 select wrapper.""" if not (r or w): # windows select() exits immediately when no sockets if timeout is None: timeout = 0.01 else: timeout = min(timeout, 0.001) sleep(timeout) return [], [], [] # windows doesn't process 'signals' inside select(), so we set a max # time or ctrl-c will never be recognized if timeout is None or timeout > 0.5: timeout = 0.5 r, w, e = select.select(r, w, w, timeout) return r, w + e, [] Eric.