Can I disable the thread pool created by gtask? How should it be disabled if possible?
I noticed that when the same code is launched under X11, the application will not create so many threads, but if it is launched under wayland, it will create the same number of threads as the number of cores.
And I try to use gio::Task to manage tasks under rust, but I find it is not as convenient as using tokio, so I prefer to use tokio to manage my tasks.
So is this thread pool necessary? Even if it is, is it possible to reduce the number of threads some?
The thread pool will start any time GTK performs an async operation internally, AFAIK with the X11 backend that will happen whenever you perform a clipboard or drag and drop operation.
So no, there is no way to get any control of that outside of changing GTK internals. But I don’t understand why tokio is needed unless you have some other library that depends on it. You should not need to ever use gio::Task directly in regular app code. Use the MainContext::spawn functions for regular async futures, or use gio::spawn_blocking for a high-level way to access the gio thread pool.