title: Communication between async tasks and synchronous threads in python
body: <p>I am looking for the best solution for communication between async tasks and methods/functions that run in a thread pool executor from concurrent.futures. In previous synchronous projects, I would use the <code>queue.Queue</code> class. I assume that any method should be thread safe and therefore the <code>asyncio.queue</code> will not work. </p>
  
  <p>I have seen people extend the <code>queue.Queue</code> class to do something like:</p>
  
  <pre><code>class async_queue(Queue):
    async def aput(self, item):
      self.put_nowait(item)
  
    async def aget(self):
      resp = await asyncio.get_event_loop().run_in_executor( None, self.get )
      return resp
  </code></pre>
  
  <p>Is there a better way? </p>