Launch a task that will be cancelled and waited for in the BTS destructor.
std::int64_t
ActiveTasksApprox () const noexcept
Approximate number of currently active tasks.
Detailed Description
A storage that allows one to start detached tasks; cancels and waits for unfinished tasks completion at the destructor. Provides CancelAndWait to explicitly cancel tasks (recommended).
Usable for detached tasks that capture references to resources with a limited lifetime. You must guarantee that the resources are available while the BackgroundTaskStorage is alive.
Usage synopsis
std::string x = kString;
std::string y;
{
// You must guarantee that 'x' and 'y' are alive during 'bts' lifetime.