Futex hang when running event loop on a separated thread

Zachary Ware zachary.ware+pylist at gmail.com
Tue Nov 24 13:11:10 EST 2015


On Tue, Nov 24, 2015 at 9:46 AM, Marc Aymerich <glicerinu at gmail.com> wrote:
> if __name__ == '__main__':
>     loop_container = {}
>     handler = threading.Thread(target=run_loop, args=(loop_container, ))
>     handler.start()
>     try:
>         time.sleep(10000)
>     finally:
>         loop_container['loop'].stop()

loop.stop() must be called from the thread running the loop.  You can
do this by doing
`loop_container['loop'].call_soon_threadsafe(loop_container['loop'].stop)`
from the main thread (untested).

Hope this helps,
-- 
Zach



More information about the Python-list mailing list