@@ -150,7 +150,7 @@ def __init__(self, queue_len=None):
150150 queue_len = 10000
151151
152152 # Processing queue
153- self ._q = trio .Queue (queue_len )
153+ self ._q_send , self . _q_recv = trio .open_memory_channel (queue_len )
154154
155155 # which files to close?
156156 self ._close_files = set ()
@@ -406,7 +406,7 @@ def call_soon_threadsafe(self, callback, *args, context=None):
406406 self ._check_callback (callback , 'call_soon_threadsafe' )
407407 self ._check_closed ()
408408 h = Handle (callback , args , self , context = context , is_sync = True )
409- self ._token .run_sync_soon (self ._q . put_nowait , h )
409+ self ._token .run_sync_soon (self ._q_send . send_nowait , h )
410410
411411 # drop all timers
412412
@@ -512,7 +512,7 @@ async def synchronize(self):
512512 def _handle_sig (self , sig , _ ):
513513 """Helper to safely enqueue a signal handler."""
514514 h = self ._signal_handlers [sig ]
515- self ._token .run_sync_soon (self ._q . put_nowait , h )
515+ self ._token .run_sync_soon (self ._q_send . send_nowait , h )
516516
517517 def add_signal_handler (self , sig , callback , * args ):
518518 """asyncio's method to add a signal handler.
@@ -741,10 +741,10 @@ async def _main_loop_one(self, no_wait=False):
741741
742742 if obj is None :
743743 if no_wait :
744- obj = self ._q . get_nowait ()
744+ obj = self ._q_recv . receive_nowait ()
745745 else :
746746 with trio .move_on_after (timeout ):
747- obj = await self ._q . get ()
747+ obj = await self ._q_recv . receive ()
748748 if obj is None :
749749 # Timeout reached. Presumably now a timer is ready,
750750 # so restart from the beginning.
0 commit comments