Player12
An open source football management simulator
Loading...
Searching...
No Matches
background_task.h File Reference
#include <future>
#include <thread>
#include <type_traits>
#include <utility>

Go to the source code of this file.

Functions

template<class Function >
auto launchBackgroundTask (std::jthread &worker, Function function)
 

Function Documentation

◆ launchBackgroundTask()

template<class Function >
auto launchBackgroundTask ( std::jthread &  worker,
Function  function 
)

Starts work on an explicitly owned thread and returns its result channel. The owner must outlive captured objects. Reusing or destroying the worker joins its previous task; exceptions travel through the returned future.