Understanding GLib.Mainloop EventSource Priority


So as i understand it we can attach Sources to a mainloop, and the mainloop will check them for events according to the priority.

My assumption was that this works like a queue, where sources with higher priority are just checked before sources with lower priority. And a Mainloop Iteration means it went through all available sources. Meaning that each source is checked in an iteration, although maybe very late depending on the priority.

Im asking because i have an application that receives network traffic, and sometimes it receives very much. The most important thing is that the UI stays responsive, so i wondererd if it makes sense to reduce the priority of the network source.
Whenever i receive data from the network this triggers UI updates.

Basically i want to receive somehow slower data. For network connection i use Gio.SocketClient

I wrote a Stackoverflow answer about main context priorities recently, which may help: c - The Main Event Loop in GLib and g_timeout_add_full understanding - Stack Overflow

Thanks, thats indeed the piece of information i was missing to understand it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.