-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
Add spawn_future
and spawn_future_local
convenience functions
#1201
Conversation
@bilelmoussaoui What do you think? |
Shall these use |
The goal here seems to be to actually get the global default main context. But you're right, from the function names I would also expect it to work on the thread default one. |
I have to admit that I don't know what the difference would be in practice. |
None at all unless you create other main contexts in your application and run those from other threads. That seems very uncommon in GTK applications, but for example is how the GDBus thread and some other helper threads inside GIO work. It's more common a pattern in libraries. |
I guess, in that case, I wouldn't mind changing it to |
It would only behave differently if you run it from a thread that explictly set another main context as the thread default one. It would behave exactly the same as GIO async operations (and |
I understand :) |
The behaviour of |
c8833cc
to
3bc0c85
Compare
A couple of gtk-rs apps currently use utility functions to make spawning futures less verbose. See: - https://docs.rs/gtk-macros/0.3.0/gtk_macros/macro.spawn.html - https://gitlab.gnome.org/GNOME/loupe/-/blob/main/src/util/mod.rs#L251 Exposing these functions via glib should fulfill that need.
3bc0c85
to
2ae030c
Compare
Okay! I've adapted the PR accordingly. |
Followup to gtk-rs#1201 Allow to set custom priority for the spawned futures.
Followup to gtk-rs#1201 Allow to set custom priority for the spawned futures.
A couple of gtk-rs apps currently use utility functions to make spawning futures less verbose.
See:
Exposing these functions via glib should fulfill that need.