periodically execute a callback