1

I have a 3rd party library with mainloop. I want to use GLib/Gtk with the app I'm developing. Is it possible to integrate GLib mainloop into another host?

The host loop allows to register an fd and execute nonblocking callback. Does GLib mainloop expose an fd to poll on and a function to process single event?

2 Answers 2

1

In general when joining two frameworks that both have main loops, you have to decide on one to be the "main one" and from inside its callbacks call the contents of the main loop of the other one.

But since your question seems to be "register an fd and execute nonblocking callback", maybe this could be your solution?

Sign up to request clarification or add additional context in comments.

Comments

1

For example, NetworkManaget integrates a GMainContex in another GMainContext. It also integrates a systemd event loop in a GMainContext.

It should also be possible, to integrate a GMainContext in another mainloop.

I'd look at the NetworkManager sources here.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.