Callback cleaner: context can be taken from timer
This commit is contained in:
@ -14,21 +14,22 @@ namespace sc {
|
||||
uint64_t _id {};
|
||||
double _time {};
|
||||
bool _repeat {};
|
||||
void (*_expired_func)(timer* self, void* context);
|
||||
void (*_expired_func)(timer* self);
|
||||
void* _context {};
|
||||
|
||||
static void callback(union sigval);
|
||||
|
||||
public:
|
||||
timer(void(*expired_func)(timer*, void*),
|
||||
double time,
|
||||
timer(double time,
|
||||
bool repeat,
|
||||
void* context);
|
||||
void(*expired_func)(timer*),
|
||||
void* context = nullptr);
|
||||
~timer();
|
||||
|
||||
uint64_t id() const { return _id; }
|
||||
double time() const { return _time; }
|
||||
bool repeat() const { return _repeat; }
|
||||
void* context() const { return _context; }
|
||||
|
||||
bool is_armed() const;
|
||||
void time_left(struct itimerspec& cur_value) const;
|
||||
|
Reference in New Issue
Block a user