userver: concurrent::BackgroundTaskStorageCore Class Reference
Loading...
Searching...
No Matches
concurrent::BackgroundTaskStorageCore Class Referencefinal

#include <userver/concurrent/background_task_storage.hpp>

Detailed Description

A version of concurrent::BackgroundTaskStorage for advanced use cases (e.g. driver internals) that can take the ownership of any kind of task.

Definition at line 21 of file background_task_storage.hpp.

Public Member Functions

 BackgroundTaskStorageCore ()
 Creates an empty BTS.
 
 BackgroundTaskStorageCore (BackgroundTaskStorageCore &&)=delete
 
BackgroundTaskStorageCoreoperator= (BackgroundTaskStorageCore &&)=delete
 
void CancelAndWait () noexcept
 
void CloseAndWaitDebug () noexcept
 
void Detach (engine::Task &&task)
 Detaches task, allowing it to continue execution out of scope. It will be cancelled and waited for on BTS destruction.
 
std::int64_t ActiveTasksApprox () const noexcept
 Approximate number of currently active tasks.
 

Member Function Documentation

◆ CancelAndWait()

void concurrent::BackgroundTaskStorageCore::CancelAndWait ( )
noexcept

Explicitly cancel and wait for the tasks. New tasks must not be launched after this call returns. Should be called no more than once.

◆ CloseAndWaitDebug()

void concurrent::BackgroundTaskStorageCore::CloseAndWaitDebug ( )
noexcept

Explicitly wait for execution tasks in the store. Should be called no more than once.

◆ Detach()

void concurrent::BackgroundTaskStorageCore::Detach ( engine::Task && task)

Detaches task, allowing it to continue execution out of scope. It will be cancelled and waited for on BTS destruction.

Note
After detach, Task becomes invalid

Can be called from a coroutine or a non-coroutine thread.


The documentation for this class was generated from the following file: