[Python-Dev] asyncio.wait(FIRST_COMPLETED) returns more than one completions - 3.4rc2

Guido van Rossum guido at python.org
Wed Mar 19 19:31:03 CET 2014


Hi Imran,

The python-dev list is not the place to ask questions about the usage of
Python modules or features. However, since you are asking an
asyncio-related question, you should be welcome at the python-tulip list:
https://groups.google.com/forum/?fromgroups#!forum/python-tulip

--Guido


On Wed, Mar 19, 2014 at 11:07 AM, Imran Geriskovan <
imran.geriskovan at gmail.com> wrote:

> Code below has been written with the intension of acquiring ONLY one lock.
> There are two issues:
>
> 1- Sometimes it returns more than one lock in done.
> 2- Sometimes, even if wait exits with zero or one locks, it seems
> there are other locks are acquired too. Though, I couldn't isolate
> the exact case for this.
>
> It sounds like some background shield() is at works.
>
> I kindly request your comments.
>
>
> locks = [some asyncio.Locks...]
> sel = [Pack(l.acquire(), l) for l in locks]
> done, pend = asyncio.wait(sel, timeout=10, return_when=FIRST_COMPLETED)
> ...
> @coroutine
> def Pack(co, obj):
>     yield from co
>     return obj
>
>
> Regards,
> Imran
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/guido%40python.org
>



-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140319/97073f02/attachment.html>


More information about the Python-Dev mailing list