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

Use glib's native async support for handling events instead of a sync glib channel #100

Open
mmstick opened this issue Aug 24, 2020 · 0 comments
Labels
improvement Improvement to code quality

Comments

@mmstick
Copy link
Member

mmstick commented Aug 24, 2020

Basically

let (sender, mut receiver) = futures::channel::mpsc::unbounded();

// Create widgets and connect signals to clones of the sender

glib::MainContext::default().spawn_local(async move {
    // Capture widgets and application state in this main async function
    while let Some(event) = receiver.next().await {
        match event {}
    }
});

For the GTK application, since it already spawns an async runtime for handling GTK signals

@mmstick mmstick added the improvement Improvement to code quality label Aug 24, 2020
@mmstick mmstick changed the title Use glib's native async support for handling events instead of a glib channel Use glib's native async support for handling events instead of a sync glib channel Aug 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement to code quality
Projects
None yet
Development

No branches or pull requests

1 participant