main context iteration



Hi!

I've got some problem with the current implementation of 
g_main_context_iterate and related (prepare, query, check, dispatch) 
functions.

As I figured out, prepare returns TRUE if it knows that there is 
something to dispatch before calling the poll (timeout occured, there is 
something to read in my stream buffer, etc). Am I right?

So I think there is a bug: g_main_context_iterate returns with the 
return value of g_main_context_prepare instead of the return value of 
g_main_context_check. The solution is trivial.

The other problem with the iteration is that it always calls all
handler functions. If we know from prepare that my poll will return
immediately, we shouldn't call the poll itself. Also we should call 
dispatch only when there is something to dispatch.
I also don't think the query loop is neccessary to do that much memory 
allocation for fds.

If my suggestions would be accepted, I send you patches as well.

Chaoron



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