fdh->error_active = EINA_TRUE;
}
- _ecore_try_add_to_call_list(obj, fdh);
+ _ecore_try_add_to_call_list(obj, pd, fdh);
if (fdh->gfd.revents & (G_IO_IN | G_IO_OUT | G_IO_ERR)) ret++;
}
if ((!ecore_idling) && (!_ecore_glib_idle_enterer_called))
{
- pd->loop_time = _ecore_time_loop_time = ecore_time_get();
+ pd->loop_time = ecore_time_get();
_efl_loop_timer_expired_timers_call(obj, pd, pd->loop_time);
efl_event_callback_call(obj, EFL_LOOP_EVENT_IDLE_ENTER, NULL);
int r = -1;
double t = _efl_loop_timer_next_get(obj, pd);
- if ((timer_fd >= 0) && (t > 0.0))
+ if ((pd->timer_fd >= 0) && (t > 0.0))
{
struct itimerspec ts;
// timerfd cannot sleep for 0 time
if (ts.it_value.tv_sec || ts.it_value.tv_nsec)
{
- r = timerfd_settime(timer_fd, 0, &ts, NULL);
+ r = timerfd_settime(pd->timer_fd, 0, &ts, NULL);
if (r < 0)
{
ERR("timer set returned %d (errno=%d)",
r, errno);
- close(timer_fd);
- timer_fd = -1;
+ close(pd->timer_fd);
+ pd->timer_fd = -1;
}
else INF("sleeping for %ld s %06ldus",
ts.it_value.tv_sec,
if (ecore_idling && (!_ecore_main_idlers_exist(pd)) &&
(!pd->message_queue))
{
- if (timer_fd >= 0)
+ if (pd->timer_fd >= 0)
{
uint64_t count = 0;
- int r = read(timer_fd, &count, sizeof count);
+ int r = read(pd->timer_fd, &count, sizeof count);
if ((r == -1) && (errno == EAGAIN))
{
}
{
// unexpected things happened... fail back to old way
ERR("timer read returned %d (errno=%d)", r, errno);
- close(timer_fd);
- timer_fd = -1;
+ close(pd->timer_fd);
+ pd->timer_fd = -1;
}
}
}
}
else
{
+#ifndef USE_G_MAIN_LOOP
pd->loop_time = ecore_time_get();
_ecore_main_loop_iterate_internal(obj, pd, 1);
+#else
+ g_main_context_iteration(NULL, 0);
+#endif
}
}
}
else
{
+#ifndef USE_G_MAIN_LOOP
pd->in_loop++;
pd->loop_time = ecore_time_get();
_ecore_main_loop_iterate_internal(obj, pd, !may_block);
pd->in_loop--;
return pd->message_queue ? 1 : 0;
+#else
+ return g_main_context_iteration(NULL, may_block);
+#endif
}
return 0;
}
}
else
{
+#ifndef USE_G_MAIN_LOOP
pd->in_loop++;
pd->loop_time = ecore_time_get();
while (!pd->do_quit)
_ecore_main_loop_iterate_internal(obj, pd, 0);
pd->do_quit = 0;
pd->in_loop--;
+#else
+ if (!pd->do_quit)
+ {
+ if (!ecore_main_loop)
+ ecore_main_loop = g_main_loop_new(NULL, 1);
+ g_main_loop_run(ecore_main_loop);
+ }
+ pd->do_quit = 0;
+#endif
}
}