Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support coroutine exitfuncs for non-main loops #1368

Commits on Aug 11, 2024

  1. Support coroutine exitfuncs for non-main loops

    Since an API consumer can cause loops to be instantiated
    for non-main threads, support coroutine exitfuncs for each
    loop. The included Socks5ServerAtExitThreadedTestCase calls
    get_socks5_proxy from a non-main thread, and demonstrates
    that coroutine exitfuncs for the resulting non-main loop
    will reliably stop the socks5 proxy via atexit hook.
    
    The _thread_weakrefs_atexit function will now make a
    temporary adjustment to _thread_weakrefs.loops so that a
    loop is associated with the current thread when it is
    closing. Also, the _get_running_loop function will now
    store weak references to all _AsyncioEventLoop instances
    it creates, since each has a _coroutine_exithandlers
    attribute that can be modified by atexit_register calls.
    
    Bug: https://bugs.gentoo.org/937740
    Signed-off-by: Zac Medico <zmedico@gentoo.org>
    zmedico committed Aug 11, 2024
    Configuration menu
    Copy the full SHA
    cb0c09d View commit details
    Browse the repository at this point in the history