Scheduler: Allow a grace period when cancelling tasks

Previously, we always cancelled a task immediately. This allows us to
optionally allow it to run for up to a specified maximum grace period
before being cancelled (this assumes that the task continues to be
driven by calls to step()).

Change-Id: Id7fcc9ecf5c1704d523826f1ba37411ffd479793
Merge "Scheduler: Allow a grace period when cancelling tasks"