From 96e5cc193ee5875225434cb7bdfd835ee2b982f9 Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Wed, 24 Jan 2024 09:19:34 +0100 Subject: [PATCH] Make context mutable the user callback gets a const timer ref, so in principle the context would always be read-only. However, in practice it would often be desirable to mutate the passed context. Therfore, it's now mutable. --- src/timer.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/timer.hpp b/src/timer.hpp index 3eed608..a171d84 100644 --- a/src/timer.hpp +++ b/src/timer.hpp @@ -10,12 +10,12 @@ namespace sc { static uint64_t next_id; static std::mutex mutex; - timer_t _tid; uint64_t _id {}; double _time {}; bool _repeat {}; void (*_expired_func)(const timer& self); - void* _context {}; + mutable void* _context {}; + timer_t _tid; static void callback(union sigval);