diff --git a/src/lib/error.h b/src/lib/error.h index f879330a9..f4fbc0857 100644 --- a/src/lib/error.h +++ b/src/lib/error.h @@ -128,7 +128,7 @@ lumiera_err LUMIERA_ERROR_##err = "LUMIERA_ERROR_" #err ":" msg /** * Helper macro to raise an error for the current thread. * Same as LUMIERA_ERROR_SET(), but logs at 'LOG_WARNING' level. - * Use this when a not unexected error happens which can be handled. + * Use this when a not unexpected error happens which can be handled. * @param flag NoBug flag describing the subsystem where the error was raised * @param err name of the error without the 'LUMIERA_ERROR_' prefix (example: NO_MEMORY) * @param extra optional string (or NULL) which adds some more context to the error, can be a temporary diff --git a/src/lib/lockerror.c b/src/lib/lockerror.c index 3295eff52..2bd73809f 100644 --- a/src/lib/lockerror.c +++ b/src/lib/lockerror.c @@ -47,6 +47,10 @@ lumiera_lockerror_set (int err, struct nobug_flag* flag, const struct nobug_cont { case 0: break; + case ETIMEDOUT: + lumiera_error_set(LUMIERA_ERROR_LOCK_TIMEOUT, ctx.func); + // no implicit logging, since timeout can be intentional + break; case EINVAL: LUMIERA_ERROR_SET_ALERT(NOBUG_FLAG_RAW(flag), LOCK_INVAL, ctx.func); break; @@ -59,9 +63,6 @@ lumiera_lockerror_set (int err, struct nobug_flag* flag, const struct nobug_cont case EPERM: LUMIERA_ERROR_SET_ALERT(NOBUG_FLAG_RAW(flag), LOCK_PERM, ctx.func); break; - case ETIMEDOUT: - LUMIERA_ERROR_SET(NOBUG_FLAG_RAW(flag), LOCK_TIMEOUT, ctx.func); - break; case EAGAIN: LUMIERA_ERROR_SET_WARNING(NOBUG_FLAG_RAW(flag), LOCK_AGAIN, ctx.func); break; diff --git a/src/proc/control/looper.hpp b/src/proc/control/looper.hpp index cfeffa3fd..04ce1a2cf 100644 --- a/src/proc/control/looper.hpp +++ b/src/proc/control/looper.hpp @@ -207,7 +207,7 @@ namespace control { ulong /////////////////////////////////////////////TICKET #1056 : better return a std::chrono value here getTimeout() const { - if (isDisabled()) + if (isDisabled() or not dirty_) return 0; else return wakeTimeout_ms() diff --git a/tests/core/proc/control/dispatcher-looper-test.cpp b/tests/core/proc/control/dispatcher-looper-test.cpp index e29372386..4b1cb52a0 100644 --- a/tests/core/proc/control/dispatcher-looper-test.cpp +++ b/tests/core/proc/control/dispatcher-looper-test.cpp @@ -124,6 +124,10 @@ namespace test { CHECK (not looper.isDying()); CHECK (looper.shallLoop()); CHECK (not looper.runBuild()); + CHECK (isDisabled (looper.getTimeout())); + + setup.has_commands_in_queue = true; + CHECK (looper.requireAction()); uint timeout = looper.getTimeout(); CHECK (10 < timeout, "configured idle timeout %2u to short", timeout); @@ -397,7 +401,7 @@ namespace test { CHECK (not looper.runBuild()); // ...note: now done with building CHECK ( looper.isIdle()); - CHECK (isSlow (looper.getTimeout())); // ...now Dispatcher is idle and goes to sleep + CHECK (isDisabled(looper.getTimeout())); // ...now Dispatcher is idle and goes to sleep setup.has_commands_in_queue = true; // next command pending @@ -425,7 +429,7 @@ namespace test { CHECK (not looper.requireAction()); CHECK ( looper.isDisabled()); CHECK (not looper.isWorking()); - CHECK (not looper.runBuild()); // ...note: dirty state hidden by disabled state + CHECK (not looper.runBuild()); // ...note: dirty state hidden by disabled state CHECK (not looper.isIdle()); CHECK (isDisabled (looper.getTimeout())); @@ -436,7 +440,7 @@ namespace test { CHECK (not looper.requireAction()); CHECK (not looper.isDisabled()); CHECK (not looper.isWorking()); - CHECK ( looper.runBuild()); // ...note: dirty state revealed again + CHECK ( looper.runBuild()); // ...note: dirty state revealed again CHECK (not looper.isIdle()); CHECK (isFast (looper.getTimeout())); @@ -447,7 +451,7 @@ namespace test { CHECK (not looper.requireAction()); CHECK ( looper.isDisabled()); CHECK (not looper.isWorking()); - CHECK (not looper.runBuild()); // ...note: dirty state not obvious + CHECK (not looper.runBuild()); // ...note: dirty state not obvious CHECK (not looper.isIdle()); CHECK (isDisabled (looper.getTimeout())); @@ -458,10 +462,10 @@ namespace test { CHECK (not looper.requireAction()); CHECK (not looper.isDisabled()); CHECK (not looper.isWorking()); - CHECK (not looper.runBuild()); // ...note: but now it becomes clear builder is not dirty + CHECK (not looper.runBuild()); // ...note: but now it becomes clear builder is not dirty CHECK ( looper.isIdle()); - CHECK (isSlow (looper.getTimeout())); + CHECK (isDisabled (looper.getTimeout())); setup.has_commands_in_queue = true; // more commands again @@ -490,7 +494,7 @@ namespace test { CHECK ( looper.requireAction()); CHECK ( looper.isDisabled()); CHECK (not looper.isWorking()); - CHECK (not looper.runBuild()); // ...note: still no need for builder run, since in shutdown + CHECK (not looper.runBuild()); // ...note: still no need for builder run, since in shutdown CHECK (not looper.isIdle()); CHECK (isDisabled (looper.getTimeout()));