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


Groups > comp.lang.python > #99380

Re: Futex hang when running event loop on a separated thread

From Zachary Ware <zachary.ware+pylist@gmail.com>
Newsgroups comp.lang.python
Subject Re: Futex hang when running event loop on a separated thread
Date 2015-11-24 12:11 -0600
Message-ID <mailman.23.1448388696.20593.python-list@python.org> (permalink)
References <CA+DCN_s77howCh5ptdGwtsF9Z3-r0nRhu-q2t43jdXKTdqSMGw@mail.gmail.com> <CA+DCN_vp8nFS-gOrQMYYefhVt2W0oAP+rFcKQbQ7K+hOHwvuuQ@mail.gmail.com>

Show all headers | View raw


On Tue, Nov 24, 2015 at 9:46 AM, Marc Aymerich <glicerinu@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

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


Thread

Re: Futex hang when running event loop on a separated thread Zachary Ware <zachary.ware+pylist@gmail.com> - 2015-11-24 12:11 -0600

csiph-web