Concurrency models (was: Timer)
Alex Martelli
aleax at aleax.it
Tue Oct 28 09:44:39 EST 2003
Anthony Briggs wrote:
...
> I'll take your word for it. It sounds like a recipe for a lot of hair
> pulling to me. What happens if there's some part of your code that
> you don't want interrupted? eg. database commits, file access, any
> sort of time critical stuff, that sort of thing. Is there a way to
> switch it off?
Event-driven processing, AKA asynchronous processing, is not
pre-emptive: on the contrary, it relies on each event handler
(callback) terminating reasonably promptly and thus returning
to the main loop. Hmmm -- ever programmed a GUI...?
>>I thought you were arguing AGAINST the 'after' functionality,
>>and therefore against event-driven programming...?!
>
> Perhaps I was taking his words a little too literally. As far as I
> can tell with threads, etc, they're little better than voodoo. So the
Threads are best kept in their place by keeping them well separated
with Queue instances, although I wouldn't be surprised to hear that
the blood of a black roster strangled at midnight is also effective.
> after statement is at least as robust, even if it's a complete
> horror...
Nope -- the callback is done in the same thread that requested
it, so "thread separation" is not at issue.
Alex
More information about the Python-list
mailing list