Re: [Discuss] Make a thinner Glib/GTK+ to fit tiny device better



2015-10-17 1:26 GMT+08:00 Emmanuele Bassi <ebassi gmail com>:
Hi;

On 16 October 2015 at 18:15, cee1 <fykcee1 gmail com> wrote:

The idea here is trying to make a thinner event loop.

You keep using that word, "thin". I don't think it means what you
think it means.

You have consistently failed to bring any measurement, or any metric,
that would allow you (or anybody else) to identify what's the current
state of GLib, and how would we identify a "thinner" version of GLib.

Saying that you want a "lightweight" version of GLib is pointless, if
you also don't define a system of measurement that defines what
"lightweight" even means.

Yeah, a profile/measurement is necessary when discuss '*thin*'. While
on the other hand, IMHO, comparing similar libraries which deploying
different approaches may inspire some ideas. Here, as an example: the
COW approach to remove duplication, a simpler event loop ...

Quite frankly, GMainLoop seems a little complicated to me, especially
compared with the event handling in GCD[1]. Hence, I'm wondering
whether I can combine an external event loop without GMainContext
involved.


I'm wondering is it a thinner and cleaner implementation, that
GTK+/GIO/etc provide hooks and let client or utility/glue library use
these hooks to put GTK+/GIO/etc into their event loop.

The idea is to have a fd-based interface that lets you extract a
(pollable) descriptor from GMainContext, and additional main loops can
poll on that; see the (lengthy) discussion on:
https://bugzilla.gnome.org/show_bug.cgi?id=699132

Thanks for pointing out this patch out :)

In this patch, the iteration of the event loop is
poller->funcs->iterate(), take epoller as an example, which will then:

1. Invoke g_main_loop_prepare_poll() to invoke GSource.prepare, and
notify epoller to update epoll_fd through "add_fd / modify_fd /
remove_fd" in context_update_poller().

2. Do epoll()

3. Invoke g_main_loop_process_poll() to run GSource.check and GSource.dispatch.

It is a big step to utilize scalable event loop implementation, while
still a little complicated...



---
1. https://github.com/cee1/cee1.archive/blob/master/documents/libdispatch-event.pdf

- Regards,

cee1


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