As long as using the created Gsource with GMainContext, the call of poll(2)
system call with infinite timeout surely returns when quit() method is
called for the context. All of GMainContext implements GWakeup with eventfd
and the call of quit() emits event via file descriptor of eventfd. This
brings wakeup from blocking when poll(2) is called with inifinite timeout.
This means that it's necessarily need to have explicit timeout internally.
This commit removes implementation of GSourceFunc.prepare for the reason.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
elem_id, mask);
}
-static gboolean ctl_card_prepare_src(GSource *src, gint *timeout)
-{
- *timeout = 500;
-
- // This source is not ready, let's poll(2).
- return FALSE;
-}
-
static gboolean ctl_card_check_src(GSource *gsrc)
{
CtlCardSource *src = (CtlCardSource *)gsrc;
GError **error)
{
static GSourceFuncs funcs = {
- .prepare = ctl_card_prepare_src,
.check = ctl_card_check_src,
.dispatch = ctl_card_dispatch_src,
.finalize = ctl_card_finalize_src,