GLib Main event loop with IOChannel and order of events?


I'm writing a UDP server where I set up 1 socket for multicast messages(SOCKET A) and 1 for the wildcard address ANY(SOCKET B). These sockets are monitored as IOChannels and added to the main event loop.

In case of receiving a single multicast message I get 1 event on SOCKET A and 1 event on SOCKET B. This is expected, but now I want to make sure that the events for SOCKET A is always handled before events SOCKET B. The reason I don't want to use the event priority feature is that I'm concerned with starvation of low priority events.

I have observed that the order of adding the IOChannels watches (SOCKET A/B) to the Main loop affects the order of their handling. If I add the SOCKET A event to the Main event loop before I add the SOCKET B event, SOCKET A events are always handled first which is the behavior I want.

1) Can this observed behavior be trusted or is it just a fluke?
2) Is my starvation concern unfounded?
3) Is there any other way to achieve what I want?

Thanks for your insights


Kolla på video med dina Messenger-polare! Messenger TV

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]