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
MainContext
of a GTK [Application
][2]. I thinkApplication
should already have aMainContext
, and I'm not sure if creating a new one is safe. -
In a task spawned by
MainContext::spawn
I'm not sure which async I/O function/traits I can use. I think I can useAsyncRead
/AsyncWrite
fromfutures
but that's not documented. -
In a task I'm not sure how to spawn more tasks. Should I pass a copy of
MainContext
to my tasks and use it to spawn more tasks via thespawn
method?