Add a framework to register the timer event handler recursively and safely.