summaryrefslogtreecommitdiff
path: root/legacy/ecore/src/lib/ecore/ecore_main.c
diff options
context:
space:
mode:
authorMike McCormack <mj.mccormack@samsung.com>2011-07-12 06:11:14 +0000
committerMike McCormack <mikem@ring3k.org>2011-07-12 06:11:14 +0000
commit92723a2ee5101c54c302d2b4c4d167b53dd6ddd5 (patch)
tree6a4a2fbcdfc04678f26075c760e17294650759f4 /legacy/ecore/src/lib/ecore/ecore_main.c
parent87b27ee044eb0250c1180f35e2e9ceb887209fa9 (diff)
ecore: Wake main loop immediately on zero sleep
Signed-off-by: Mike McCormack <mj.mccormack@samsung.com> SVN revision: 61268
Diffstat (limited to '')
-rw-r--r--legacy/ecore/src/lib/ecore/ecore_main.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/legacy/ecore/src/lib/ecore/ecore_main.c b/legacy/ecore/src/lib/ecore/ecore_main.c
index 37b2c73a98..e782b2da3c 100644
--- a/legacy/ecore/src/lib/ecore/ecore_main.c
+++ b/legacy/ecore/src/lib/ecore/ecore_main.c
@@ -483,7 +483,7 @@ static inline int _ecore_main_fdh_glib_mark_active(void)
483static gboolean 483static gboolean
484_ecore_main_gsource_prepare(GSource *source __UNUSED__, gint *next_time) 484_ecore_main_gsource_prepare(GSource *source __UNUSED__, gint *next_time)
485{ 485{
486 gboolean running; 486 gboolean ready = FALSE;
487 487
488 in_main_loop++; 488 in_main_loop++;
489 489
@@ -500,8 +500,7 @@ _ecore_main_gsource_prepare(GSource *source __UNUSED__, gint *next_time)
500 while (_ecore_signal_count_get()) _ecore_signal_call(); 500 while (_ecore_signal_count_get()) _ecore_signal_call();
501 501
502 /* don't check fds if somebody quit */ 502 /* don't check fds if somebody quit */
503 running = g_main_loop_is_running(ecore_main_loop); 503 if (g_main_loop_is_running(ecore_main_loop))
504 if (running)
505 { 504 {
506 /* only set idling state in dispatch */ 505 /* only set idling state in dispatch */
507 if (ecore_idling && !_ecore_idler_exist() && !_ecore_event_exist()) 506 if (ecore_idling && !_ecore_idler_exist() && !_ecore_event_exist())
@@ -510,7 +509,7 @@ _ecore_main_gsource_prepare(GSource *source __UNUSED__, gint *next_time)
510 { 509 {
511 int r = -1; 510 int r = -1;
512 double t = _ecore_timer_next_get(); 511 double t = _ecore_timer_next_get();
513 if (timer_fd >= 0) 512 if (timer_fd >= 0 && t > 0.0)
514 { 513 {
515 struct itimerspec ts; 514 struct itimerspec ts;
516 515
@@ -536,23 +535,33 @@ _ecore_main_gsource_prepare(GSource *source __UNUSED__, gint *next_time)
536 } 535 }
537 } 536 }
538 if (r == -1) 537 if (r == -1)
539 *next_time = ceil(t * 1000.0); 538 {
539 *next_time = ceil(t * 1000.0);
540 if (t == 0.0)
541 ready = TRUE;
542 }
540 } 543 }
541 else 544 else
542 *next_time = -1; 545 *next_time = -1;
543 } 546 }
544 else 547 else
545 *next_time = 0; 548 {
549 *next_time = 0;
550 if (_ecore_event_exist())
551 ready = TRUE;
552 }
546 553
547 if (fd_handlers_with_prep) 554 if (fd_handlers_with_prep)
548 _ecore_main_prepare_handlers(); 555 _ecore_main_prepare_handlers();
549 } 556 }
557 else
558 ready = TRUE;
550 559
551 in_main_loop--; 560 in_main_loop--;
552 INF("leave, timeout = %d", *next_time); 561 INF("leave, timeout = %d", *next_time);
553 562
554 /* ready if we're not running (about to quit) */ 563 /* ready if we're not running (about to quit) */
555 return !running; 564 return ready;
556} 565}
557 566
558static gboolean 567static gboolean