Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #99384 > unrolled thread
| Started by | Marc Aymerich <glicerinu@gmail.com> |
|---|---|
| First post | 2015-11-24 19:37 +0100 |
| Last post | 2015-11-24 19:37 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Futex hang when running event loop on a separated thread Marc Aymerich <glicerinu@gmail.com> - 2015-11-24 19:37 +0100
| From | Marc Aymerich <glicerinu@gmail.com> |
|---|---|
| Date | 2015-11-24 19:37 +0100 |
| Subject | Re: Futex hang when running event loop on a separated thread |
| Message-ID | <mailman.25.1448390283.20593.python-list@python.org> |
On Tue, Nov 24, 2015 at 7:11 PM, Zachary Ware
<zachary.ware+pylist@gmail.com> wrote:
> 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).
>
Hi Zachary,
nice to know about call_soon_threadsafe!
still it appears to work only if the main thread is in the foreground
(as of calling Thread() with deamon=True), I don't get why it behaves
differently :( maybe it is waiting for other stuff, but no idea how to
confirm this with strace of other means.. i always see the same
'futex(0x7f9a70000c10, FUTEX_WAIT_PRIVATE, 0, NULL'
--
Marc
Back to top | Article view | comp.lang.python
csiph-web