Suggested generator to add to threading module.
Ype Kingma
ykingma at accessforall.nl
Fri Jan 16 14:42:36 EST 2004
More information about the Python-list mailing list
Fri Jan 16 14:42:36 EST 2004
- Previous message (by thread): Suggested generator to add to threading module.
- Next message (by thread): Suggested generator to add to threading module.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Andrae Muys wrote: > Found myself needing serialised access to a shared generator from > multiple threads. Came up with the following > > def serialise(gen): > lock = threading.Lock() > while 1: > lock.acquire() > try: > next = gen.next() > finally: > lock.release() > yield next Is there any reason why the lock is not shared among threads? >From the looks of this, it doesn't synchronize anything between different threads. Am I missing something? Kind regards, Ype email at xs4all.nl
- Previous message (by thread): Suggested generator to add to threading module.
- Next message (by thread): Suggested generator to add to threading module.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list