From 5711324b537c8b1a2897ee5d31b3574e8235ead6 Mon Sep 17 00:00:00 2001 From: Matthias Killat Date: Thu, 4 Jun 2020 19:19:30 +0200 Subject: [PATCH] comment on a problem with timer deletion --- include/timeout_condition_variable.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/timeout_condition_variable.hpp b/include/timeout_condition_variable.hpp index 770f0fe..e10da87 100644 --- a/include/timeout_condition_variable.hpp +++ b/include/timeout_condition_variable.hpp @@ -207,9 +207,10 @@ class TimeoutConditionVariable } while (!predicateResult); //if there is a spurious wake up we release the lock and wait again - //the node was already removed by the notify or the timeout call, so it can be safely deleted - - //also deletes the timer, if any (no ...this is a big todo, how to deal with the timer deletion) + //the node was already removed from the list by the notify or the timeout call, so it can be safely deleted + //even if the other still fires, it will find no node in the list and thus not work on deleted data + //TODO: but, in principle, it seems it could work on a newly created node on the heap with the same address, + //which would not be correct (kind of an ABA problem with pointers...) std::cout << "deleting node " << node << std::endl; delete node;