Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #102210

Re: Question about asyncio and blocking operations

From "Frank Millman" <frank@chagford.com>
Newsgroups comp.lang.python
Subject Re: Question about asyncio and blocking operations
Date 2016-01-29 07:23 +0200
Message-ID <mailman.75.1454045022.2338.python-list@python.org> (permalink)
References (8 earlier) <CAPTjJmr162+K4LZeFpXruR6wxrHxbR-_wkrCLLDyR7kST+kjYg@mail.gmail.com> <n8ct18$fu4$1@ger.gmane.org> <CALwzidnGbz7kM=D7MKua2tA9-csFn9u0OHL0w-X5Bbixpcw4Ow@mail.gmail.com> <n8dgas$s1u$1@ger.gmane.org> <CALwzidn6NfT_O0cfHw1itWja81+MW3scHuEcADVCen3ix6z73w@mail.gmail.com>

Show all headers | View raw


"Ian Kelly"  wrote in message 
news:CALwzidn6NfT_O0cfHw1itWja81+MW3scHuEcADVCen3ix6z73w@mail.gmail.com...
>
> As I commented in my previous message, asyncio.Queue is not
> thread-safe, so it's very important that the put calls here be done on
> the event loop thread using event_loop.call_soon_threadsafe. This
> could be the cause of the strange behavior you're seeing in getting
> the results.
>

Using call_soon_threadsafe makes all the difference. The rows are now 
retrieved instantly.

I have read the other messages, and I can see that there are some clever 
ideas there. However, having found something that seems to work and that I 
feel comfortable with, I plan to run with this for the time being.

Thanks to all for the very stimulating discussion.

Frank

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Question about asyncio and blocking operations "Frank Millman" <frank@chagford.com> - 2016-01-29 07:23 +0200

csiph-web