plugin: sftp transport
Andrew Bennetts
andrew at canonical.com
Thu Oct 20 14:23:49 BST 2005
Aaron Bentley wrote:
[...]
>
> >>If there were a way to get the reactor to just process the one deferred
> >>we care about, make_synchronous would be safe, and I'd feel a lot better
> >>about using twisted.
> >
> >
> > This statement doesn't really make much sense to me -- Deferreds and the
> > reactor don't inherently have anything to do with each other.
>
> Okay, maybe I'm misunderstanding the specifics. I thought that the
> problem with make_synchronous was that it could not be induced to *only*
> process the stream we were trying to synchronously access, and hence
> would interact badly with async programs.
Well, make_synchronous doesn't necessarily have anything to do with streams,
either ;)
But yes, all make_synchronous does is call and async function and wait for
the operation it kicks off to complete, whatever it may be. The event loop
(i.e. the reactor) may well be doing other things at the same time.
Of course, if you only ever call async code via make_synchronous'd functions
that won't happen. I expect that's going to be a common case in bzr, but
maybe I'm wrong.
[Well, unless the async code you invoke creates other operations and doesn't
wait for them to complete -- which isn't much different to leaving threads
or changes to global state lying around: often a bad idea, and something to
be wary of. Potentially this could be useful, e.g. an optimisation of
holding open an unused HTTP connection for a few seconds in case it can be
re-used. But that sort of thing ought be completely transparent to the
high-level caller of getPage or whatever.]
-Andrew.
More information about the bazaar
mailing list