[Twisted-Python] threadedselectreactor and twistd
Bob Ippolito
bob at redivi.com
Mon Sep 12 14:42:39 EDT 2005
The problem that it solves is inherent to the reactor API, and the
implementations of those reactors. twistd supports the reactor API
as-is, so it's not going to support an alternative to that API. But
yes, twistd isn't really appropriate for the same kind of typical use
cases that threadedselectreactor is. You're better off writing your
app as you would normally do it, and invoking part of the twistd
machinery yourself from inside there.
What really needs to happen is that the reactor API needs to be
refactored such that any reactor can be used as a threaded reactor.
Right now the idea of the threaded*reactor and the select() backend
are conflated. They don't have to be, and shouldn't, but I really
didn't have the need to come up with such an API and change
everything, I only needed one good implementation.
-bob
On Sep 12, 2005, at 11:28 AM, Antony Kummel wrote:
> Not sure what you mean.
>
> If threadedselectreactor can't integrate with twistd,
> then the problem that threadedselectreactor solves is
> inherent to twistd, in which case twistd is simply
> unsuitable for some uses (i.e. GUI)?
>
> --- Bob Ippolito <bob at redivi.com> wrote:
>
>
>>
>> On Sep 11, 2005, at 11:06 AM, Antony Kummel wrote:
>>
>>
>>> Just wondering how and if to integrate
>>> threadedselectreactor into twistd. I'm thinking to
>>>
>> use
>>
>>> it for a GUI application which is also a server
>>>
>> (and a
>>
>>> client), so I think using mktap/twistd makes
>>>
>> sense,
>>
>>> but there is the matter of threadedselectreactor
>>>
>> not
>>
>>> being supported.
>>>
>>> What I've been thinking is for
>>>
>> threadedselectreactor
>>
>>> to have another method, or it could be combined
>>>
>> with
>>
>>> interleave, that accepts a callable that makes the
>>> main loop run. It could also be a special reactor
>>>
>> for,
>>
>>> say, wxPython, that accepts a wxApp (and
>>>
>> interleaves
>>
>>> automatically), and calls its MainLoop method
>>>
>> inside
>>
>>> reactor.run(). This would make it trivial to use
>>>
>> with
>>
>>> twisted.application. It would simple require the
>>> service to let the reactor know about its
>>> wxApp/whatever.
>>>
>>> Any thoughts?
>>>
>>
>> I don't think that's really going to work without a
>> bunch of
>> refactoring of twistd and special-cases for each
>> environment -- which
>> is the problem that threadedselectreactor solves in
>> the first place.
>>
>> -bob
>>
>>
>>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
More information about the Twisted-Python
mailing list