MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ submit()

template<typename T = void>
void MayaFlux::Parallel::AsyncGroup< T >::submit ( std::future< T >  fut)
inline

Retains fut and opportunistically reclaims completed work.

Thread-safe: any number of threads may call submit() concurrently. Every call also performs a non-blocking sweep of previously submitted futures, so the retained set does not grow unbounded under steady submission even though no background thread ever runs.

Parameters
futFuture to retain. Must have been launched already, for example via std::async(std::launch::async, ...); submit() does not start the work.

Definition at line 101 of file AsyncGroup.hpp.

102 {
103 m_tasks.push(std::move(fut));
104
105 m_tasks.sweep(
106 [](std::future<T>& f) {
107 return f.wait_for(std::chrono::seconds(0)) == std::future_status::ready;
108 },
109 [this](std::future<T>& f) { finish(f); });
110 }
void finish(std::future< T > &f)
Memory::SweepList< std::future< T > > m_tasks

References MayaFlux::Parallel::AsyncGroup< T >::finish(), and MayaFlux::Parallel::AsyncGroup< T >::m_tasks.

Referenced by MayaFlux::IO::IOManager::track_save_task().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: