ditto
Boost Software License Version 1.0. See LICENSE_BOOST.txt for details. Alternatively, this file may be distributed under the terms of the Tango 3-Clause BSD License (see LICENSE_BSD.txt for details).
Copyright (c) 2018 dunnhumby Germany GmbH. All rights reserved.
Utility to wrap any task and turn it into valid ISuspendable.
Originally Task class itself was implementing ISuspendable but it had to be removed because with current scheduler implementation it is not legal for tasks to resume each other directly. Calling suspend is also only legal from within the to-be-suspended task.
TaskSuspender workarounds it by calling delayedResume instead on a wrapped task and adding extra sanity checks about suspending context.