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

threadpoolexecutor #27

Open
bidasknakayama opened this issue Jan 15, 2025 · 1 comment
Open

threadpoolexecutor #27

bidasknakayama opened this issue Jan 15, 2025 · 1 comment

Comments

@bidasknakayama
Copy link

bidasknakayama commented Jan 15, 2025

After I closed a serial ,
but I can see a ThreadPoolExecutor job still in Visual Studio code debugger.
How to close it ?
I worry memory leak..

Could you help it ?

I added this. Do you think ?

    def close_threads(self):
        self._cancel_read_executor.shutdown(wait=False, cancel_futures=True)
        self._read_executor.shutdown(wait=False, cancel_futures=True)
        self._cancel_write_executor.shutdown(wait=False, cancel_futures=True)
        self._write_executor.shutdown(wait=False, cancel_futures=True)

I tried it works good !

@bidasknakayama
Copy link
Author

bidasknakayama commented Jan 15, 2025

and
Now, This library used "ThreadPoolExecutor" to execute tasks.
If we don't want to use "ThreadPoolExecutor" or "ProcessPoolExecutor",
Can we write like this ?

`self._cancel_read_executor = None

self._read_executor = None

self._cancel_write_executor = None

self._write_executor = None`

etc.etc..

I read this.
https://docs.python.org/ja/3.10/library/asyncio-eventloop.html#executing-code-in-thread-or-process-pools

We can run all task in same loop.. I like this. ( it depend on purpose )..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant