summaryrefslogtreecommitdiff
path: root/src/lib/eio
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-03-21 13:33:30 -0700
committerCedric BAIL <cedric.bail@free.fr>2019-03-27 15:03:22 -0700
commitf4426d29604a3bf43cbb241001d6f30204effe3a (patch)
tree1fb206286874abdb22238eef05fc653b90ead4c4 /src/lib/eio
parent9cadba3387a48d727c4d6dc4d59097b33cfd3a82 (diff)
eio: guarantee that we will at least process one request per loop iteration for very slow system.
Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D8447
Diffstat (limited to 'src/lib/eio')
-rw-r--r--src/lib/eio/efl_io_model.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/lib/eio/efl_io_model.c b/src/lib/eio/efl_io_model.c
index e43c9c0..e2b3697 100644
--- a/src/lib/eio/efl_io_model.c
+++ b/src/lib/eio/efl_io_model.c
@@ -388,16 +388,20 @@ _eio_build_st_then_clobber(const Efl_Io_Model *model, Efl_Io_Model_Data *pd)
388} 388}
389 389
390static Eina_List *delayed_queue = NULL; 390static Eina_List *delayed_queue = NULL;
391static Eina_Bool delayed_one = EINA_FALSE;
391 392
392static void 393static void
393_delayed_flush(void *data EINA_UNUSED, const Efl_Event *ev) 394_delayed_flush(void *data EINA_UNUSED, const Efl_Event *ev)
394{ 395{
395 Eina_Promise *p; 396 Eina_Promise *p;
396 397 Eina_List *tmp = delayed_queue;
397 EINA_LIST_FREE(delayed_queue, p)
398 eina_promise_resolve(p, EINA_VALUE_EMPTY);
399 398
400 efl_event_callback_del(ev->object, EFL_LOOP_EVENT_IDLE, _delayed_flush, NULL); 399 efl_event_callback_del(ev->object, EFL_LOOP_EVENT_IDLE, _delayed_flush, NULL);
400
401 delayed_one = EINA_FALSE;
402 delayed_queue = NULL;
403 EINA_LIST_FREE(tmp, p)
404 eina_promise_resolve(p, EINA_VALUE_EMPTY);
401} 405}
402 406
403static Eina_Value 407static Eina_Value
@@ -447,7 +451,8 @@ _eio_build_mime_now(Eo *model, void *data, const Eina_Value v)
447 if (!pd->loop) goto on_error; 451 if (!pd->loop) goto on_error;
448 452
449 // Make sure that we are not over consuming time in the main loop 453 // Make sure that we are not over consuming time in the main loop
450 if (delayed_queue || ecore_time_get() - ecore_loop_time_get() > 0.004) 454 if (!delayed_one &&
455 (delayed_queue || ecore_time_get() - ecore_loop_time_get() > 0.004))
451 { 456 {
452 Eina_Future *f = efl_future_then(model, _build_delay(model), 457 Eina_Future *f = efl_future_then(model, _build_delay(model),
453 .success = _eio_build_mime_now, 458 .success = _eio_build_mime_now,
@@ -460,6 +465,7 @@ _eio_build_mime_now(Eo *model, void *data, const Eina_Value v)
460 _eio_build_mime_clean(pd); 465 _eio_build_mime_clean(pd);
461 466
462 efl_model_properties_changed(model, "mime_type"); 467 efl_model_properties_changed(model, "mime_type");
468 delayed_one = EINA_TRUE;
463 469
464 return v; 470 return v;
465 471