Spawning async tasks in GTK apps
I'm trying to spawn async tasks in a GTK app using GLib's [MainContext::spawn][1]. Questions:
-
I'm not sure how to get
MainContextof a GTK [Application][2]. I thinkApplicationshould already have aMainContext, and I'm not sure if creating a new one is safe. -
In a task spawned by
MainContext::spawnI'm not sure which async I/O function/traits I can use. I think I can useAsyncRead/AsyncWritefromfuturesbut that's not documented. -
In a task I'm not sure how to spawn more tasks. Should I pass a copy of
MainContextto my tasks and use it to spawn more tasks via thespawnmethod?