Cancel the scheduled task.

def cancel(self):
        '''
        Cancel the scheduled task.
        '''
        if (not self.cancelled) and (self._fn is not None):
            self._cancelled = True
            self._drop_fn()