How does gmainloop schedule GSources by priority?



Hi all,
I've read some code snippets of gmain.c. It seems a high priority(small value of priority field of GSource struct) source will cause low priority one no change to be processed:
  1. The source_list field of GMainContext points to a series of  GSources ordered by priority(High -> low).
  2. In the prepare stage, *g_main_context_prepare* will only process GSources with highest priority that are ready.
  3. In the query stage, *g_main_context_query* will only get pollfd array ready for GSources with pollfds and higher priority than the max priority returned by *g_main_context_prepare*.
So if I have a IOChannel watch source with a high priority, and then attach an idle source, the idle source will have no change to be scheduled?



--
Regards,

- cee1



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