generators shared among threads
Paul Rubin
http
Wed Mar 8 06:54:28 EST 2006
aleaxit at yahoo.com (Alex Martelli) writes:
> Now, x=ReentrantIterator(itertools.count()) should have all the
> properties we want, I think. The locking is thanks of Queue.Queue and
> its sweet implementation of the Template Method design pattern.
That is very cool, and generally useful enough that maybe it should be
dropped into itertools. I see that Queue.get's implementation is
quite intricate (it uses three separate locks to handle some
additional cases like timeouts and non-blocking gets) but I'm not up
to trying to grok it right now. Thanks!
More information about the Python-list
mailing list