OK, thank you very muc for that. I need to learn about asyncio before I can even understand that code, but it looks about what I was expecting.
Hopefully if I can learn more about it, I can make some version of pyglet's event loop that'll cooperate nicely, but that'll do in the meantime. Thank you. Take care, Chris Norman On Fri, 2 Oct 2020 at 10:14, ryannathans <ryannath...@hotmail.com> wrote: > I have a thread for all async stuff (eg networking) and run pyglet on the > main thread (because windows seems to have problems if you run it in > another thread - linux is ok with it though). > > for example > > def run(self): > with concurrent.futures.ThreadPoolExecutor() as thread_pool: > #submit networking/async stuff to thread_pool > try: > pyglet.app.run() > finally: > #tell networking thread to shutdown > atexit.unregister(concurrent.futures.thread._python_exit) # > helps the program exit cleanly if there are blocking reads in threads that > will never complete > > I don't know if this is the "right way" but it works for me - just keep > all the async in one thread and communicate with it in a threadsafe manner > On Friday, 2 October 2020 at 5:32:21 am UTC+10 chris....@googlemail.com > wrote: > >> Hi all, >> Is there an officially-supported way to use asyncio from within Pyglet? >> >> If not, what's the recommended way to do networking with Pyglet? >> >> Thanks in advance. >> >> Take care, >> >> Chris Norman >> >> -- > You received this message because you are subscribed to the Google Groups > "pyglet-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to pyglet-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/pyglet-users/7cb132dc-3f3b-4e27-993f-7ad78f24f83an%40googlegroups.com > <https://groups.google.com/d/msgid/pyglet-users/7cb132dc-3f3b-4e27-993f-7ad78f24f83an%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/pyglet-users/CANjhqb9ODq4CgRhScwe_ubVO5H6L84T5sAGtODPr%2B2foYyYj5w%40mail.gmail.com.