#include <userver/engine/task/local_variable.hpp>
TaskLocalVariable is a per-coroutine variable of arbitrary type.
It is an alternative to thread_local, but per-task instead of per-thread.
The order of destruction of task-local variables is inverse to the order of initialization.
Definition at line 23 of file local_variable.hpp.
Public Member Functions | |
| T & | operator* () | 
| Get the instance of the variable for the current coroutine. Initializes (default constructs) the variable if it was not previously initialized.   | |
| T * | operator-> () | 
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.   | |
| T * | GetOptional () noexcept | 
| Get the variable instance for the current task.   | |
      
  | 
  inlinenoexcept | 
Get the variable instance for the current task.
nullptr if variable was not initialized. Definition at line 39 of file local_variable.hpp.
| T & engine::TaskLocalVariable< T >::operator* | ( | ) | 
Get the instance of the variable for the current coroutine. Initializes (default constructs) the variable if it was not previously initialized.
Definition at line 51 of file local_variable.hpp.
| T * engine::TaskLocalVariable< T >::operator-> | ( | ) | 
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 57 of file local_variable.hpp.