From bfea266536efa38c6e69ad7f7af36ea3e865265b Mon Sep 17 00:00:00 2001 From: "matthias.ringwald" Date: Wed, 28 Oct 2009 21:25:51 +0000 Subject: [PATCH] fix run loop for outdated timers --- TODO.txt | 1 + src/run_loop_posix.c | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/TODO.txt b/TODO.txt index 9ce4ecc02..3bcdfe11b 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,6 +1,7 @@ /* new todo file for BTstack */ NEXT: +- try to have BTdaemon use 0% cpu time when idle, after disconnect - implement cocoa_remove_data_source - fix BTstack and/or WiiMote Demo crash when quitting app - prepend all source files with 'new BSD' copyright header diff --git a/src/run_loop_posix.c b/src/run_loop_posix.c index 4691e43eb..8f0855021 100644 --- a/src/run_loop_posix.c +++ b/src/run_loop_posix.c @@ -94,11 +94,9 @@ void posix_execute() { tv.tv_usec += 1000000; tv.tv_sec--; } - if (tv.tv_sec < 0){ - tv.tv_sec = 0; - tv.tv_usec = 0; + if (tv.tv_sec > 0 || (tv.tv_sec == 0 && tv.tv_usec > 0)){ + timeout = &tv; } - timeout = &tv; } // wait for ready FDs