+ /*
+ * If the period is set to 0, then we do not want to dump periodically,
+ * thus we deschedule the event. Else, if the period is not 0, but the event
+ * has already been scheduled, we need to get rid of the old event before we
+ * create a new one, as the old event will no longer be moved forward in the
+ * event that we resume from a checkpoint.
+ */
+ if (dumpEvent != NULL && (period == 0 || dumpEvent->scheduled())) {
+ // Event should AutoDelete, so we do not need to free it.
+ dumpEvent->deschedule();
+ }