User callback changed, better interface
This commit is contained in:
@ -11,19 +11,28 @@ namespace sc {
|
||||
static std::mutex mutex;
|
||||
|
||||
timer_t _tid;
|
||||
uint64_t _id;
|
||||
double _time;
|
||||
bool _repeat;
|
||||
uint64_t _id {};
|
||||
double _time {};
|
||||
bool _repeat {};
|
||||
void (*_expired_func)(timer* self, void* context);
|
||||
void* _context {};
|
||||
|
||||
static void callback(union sigval);
|
||||
|
||||
public:
|
||||
timer(void(*callback)(union sigval), double time, bool repeat = false);
|
||||
timer(void(*expired_func)(timer*, void*),
|
||||
double time,
|
||||
bool repeat,
|
||||
void* context);
|
||||
~timer();
|
||||
|
||||
uint64_t id() const { return _id; }
|
||||
double time() const { return _time; }
|
||||
bool repeat() const { return _repeat; }
|
||||
|
||||
bool is_armed() const;
|
||||
void time_left(struct itimerspec& cur_value) const;
|
||||
double time_left() const;
|
||||
double time() const { return _time; }
|
||||
bool is_armed() const;
|
||||
bool repeat() const { return _repeat; }
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user