From a49d79ffbdccaa73641016ed1e5d5ddf250610bc Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 17 Nov 2018 17:00:39 +0100 Subject: [PATCH] Library: fix spurious wake-up from (non)timed wait A classical carry-over of dirty values... Problem arises, when starting an unconditional wait on the same object monitor, which previously conducted a timed wait. Then the obsolete timeout from the previous wait remained in place, causing our Sync-Wrapper (erroneously) to assume a timed wait and then pthread to return immediately from this timed wait. The result was permanent idle looping in the ProcDispatcher, after the first command was processed --- src/lib/sync.hpp | 6 +++++- wiki/thinkPad.ichthyo.mm | 22 ++++++++++++++++++---- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/lib/sync.hpp b/src/lib/sync.hpp index 76c7c034b..98a9405b7 100644 --- a/src/lib/sync.hpp +++ b/src/lib/sync.hpp @@ -238,7 +238,9 @@ namespace lib { struct Timeout : timespec { - Timeout() { tv_sec=tv_nsec=0; } + Timeout() { reset(); } + + void reset() { tv_sec=tv_nsec=0; } /** initialise to NOW() + offset (in milliseconds) */ Timeout& @@ -254,6 +256,8 @@ namespace lib { tv_sec += tv_nsec / 1000000000; tv_nsec %= 1000000000; } } + else + reset(); return *this; } diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 6e4ef6083..cc66a8663 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -44602,18 +44602,32 @@ - + - - - + + + + + + + + + + + + + + + + +