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.
This commit is contained in:
parent
dedd67b0fd
commit
96e5cc193e
@ -10,12 +10,12 @@ namespace sc {
|
|||||||
static uint64_t next_id;
|
static uint64_t next_id;
|
||||||
static std::mutex mutex;
|
static std::mutex mutex;
|
||||||
|
|
||||||
timer_t _tid;
|
|
||||||
uint64_t _id {};
|
uint64_t _id {};
|
||||||
double _time {};
|
double _time {};
|
||||||
bool _repeat {};
|
bool _repeat {};
|
||||||
void (*_expired_func)(const timer& self);
|
void (*_expired_func)(const timer& self);
|
||||||
void* _context {};
|
mutable void* _context {};
|
||||||
|
timer_t _tid;
|
||||||
|
|
||||||
static void callback(union sigval);
|
static void callback(union sigval);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user