I have a module that manages timers in my aplication. This class has basibly three functions:
Instance of ACE_Reactor is used internally by the module to manage the timers.
- schedule timer - calls ACE_Reactor::schedule_timer(). One of the arguments is a callback, called upon timer experation.
- cancel timer - calls ACE_Reactor::cancel_timer()
The reactor executed in private timer of execution, so schedule/cancel and timeout callback are executed in different threads.
ACE_Reactor::schedule_timer() receives a heap allocatec structure ( arg argument).
This structure later deleted when canceling timer or when timeout handler is called. But since cancel and timeout handler are executed in different threads it looks like there's cases that the structure is deleted twice.
Isn't it responsibility of reactor to ensure that timer is canceled when timeout handler is called?