Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::format::BackgroundTaskLane< Task, Capacity > Class Template Reference

One bounded, pre-warmed audio-to-worker task lane. More...

#include <background_task_lane.hpp>

Public Types

using Handler = void (*)(void*, const Task&)
using HandlerFunction = runtime::FixedFunction<void(const Task&), 48>

Public Member Functions

 BackgroundTaskLane ()=default
 ~BackgroundTaskLane ()
 BackgroundTaskLane (const BackgroundTaskLane &)=delete
BackgroundTaskLane & operator= (const BackgroundTaskLane &)=delete
bool start (Handler handler, void *context=nullptr, BackgroundTaskPolicy policy=BackgroundTaskPolicy::Ordered)
bool start (HandlerFunction handler, BackgroundTaskPolicy policy=BackgroundTaskPolicy::Ordered)
void stop () noexcept
bool try_spawn (const Task &task) noexcept
bool running () const noexcept
std::uint64_t overflow_count () const noexcept

Detailed Description

template<typename Task, std::size_t Capacity = 64>
class pulp::format::BackgroundTaskLane< Task, Capacity >

One bounded, pre-warmed audio-to-worker task lane.

start()/stop() are control-thread operations. try_spawn() is lock-free and allocation-free after start. A lane has one consumer, so its handler is never re-entered; independent lanes run concurrently. Latest policy coalesces bursts to the newest trivially-copyable task.

The handler is a runtime::FixedFunction, so a capturing lambda is stored inline: no void* context to cast and no allocation, ever. An older function-pointer-and-context pair is still accepted.

Member Typedef Documentation

◆ Handler

template<typename Task, std::size_t Capacity = 64>
using pulp::format::BackgroundTaskLane< Task, Capacity >::Handler = void (*)(void*, const Task&)

◆ HandlerFunction

template<typename Task, std::size_t Capacity = 64>
using pulp::format::BackgroundTaskLane< Task, Capacity >::HandlerFunction = runtime::FixedFunction<void(const Task&), 48>

Constructor & Destructor Documentation

◆ BackgroundTaskLane() [1/2]

template<typename Task, std::size_t Capacity = 64>
pulp::format::BackgroundTaskLane< Task, Capacity >::BackgroundTaskLane ( )
default

◆ ~BackgroundTaskLane()

template<typename Task, std::size_t Capacity = 64>
pulp::format::BackgroundTaskLane< Task, Capacity >::~BackgroundTaskLane ( )
inline

◆ BackgroundTaskLane() [2/2]

template<typename Task, std::size_t Capacity = 64>
pulp::format::BackgroundTaskLane< Task, Capacity >::BackgroundTaskLane ( const BackgroundTaskLane< Task, Capacity > & )
delete

Member Function Documentation

◆ operator=()

template<typename Task, std::size_t Capacity = 64>
BackgroundTaskLane & pulp::format::BackgroundTaskLane< Task, Capacity >::operator= ( const BackgroundTaskLane< Task, Capacity > & )
delete

◆ overflow_count()

template<typename Task, std::size_t Capacity = 64>
std::uint64_t pulp::format::BackgroundTaskLane< Task, Capacity >::overflow_count ( ) const
inlinenoexcept

◆ running()

template<typename Task, std::size_t Capacity = 64>
bool pulp::format::BackgroundTaskLane< Task, Capacity >::running ( ) const
inlinenoexcept

◆ start() [1/2]

template<typename Task, std::size_t Capacity = 64>
bool pulp::format::BackgroundTaskLane< Task, Capacity >::start ( Handler handler,
void * context = nullptr,
BackgroundTaskPolicy policy = BackgroundTaskPolicy::Ordered )
inline

◆ start() [2/2]

template<typename Task, std::size_t Capacity = 64>
bool pulp::format::BackgroundTaskLane< Task, Capacity >::start ( HandlerFunction handler,
BackgroundTaskPolicy policy = BackgroundTaskPolicy::Ordered )
inline

◆ stop()

template<typename Task, std::size_t Capacity = 64>
void pulp::format::BackgroundTaskLane< Task, Capacity >::stop ( )
inlinenoexcept

◆ try_spawn()

template<typename Task, std::size_t Capacity = 64>
bool pulp::format::BackgroundTaskLane< Task, Capacity >::try_spawn ( const Task & task)
inlinenoexcept

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