[Python-Dev] Non-blocking (asynchronous) timer without thread?

Evgeniy Khramtsov xramtsov at gmail.com
Sat Dec 23 08:26:13 CET 2006


Bob Ippolito пишет:

> Well you simply can't do what you propose without writing code in the
> style of Twisted or with interpreter modifications or evil stack
> slicing such as with stackless or greenlet. If you aren't willing to
> choose any of those then you'll have to live without that
> functionality or use another language (though I can't think of any
> usable ones that actually safely do what you're asking). It should be
> relatively efficient to do what you want with a thread pool (one
> thread that manages all of the timers, and worker threads to execute
> the timer callbacks).
>
> FWIW, Erlang doesn't have that functionality. You can wait on messages
> with a timeout, but there are no interrupts. You do have cheap and
> isolated processes instead of expensive shared state threads, though.
> Writing Erlang/OTP code is actually a lot closer to writing Twisted
> style code than it is to other styles of concurrency (that you'd find
> in Python). It's just that Erlang/OTP has better support for
> concurrency oriented programming than Python does (across the board;
> syntax, interpreter, convention and libraries).

Ok. I see your point. It looks like Python was not the right choice for 
my task :(

Thanks.


More information about the Python-Dev mailing list