Utilities
Utilities header only library
utils::ConcurrentBinding< T > Class Template Reference

Controller for binding asynchronous processes. More...

Inheritance diagram for utils::ConcurrentBinding< T >:
[legend]

Public Member Functions

void Run (const std::function< T(void)> &func)
 Execute provided function asynchronously from a caller thread.
 
bool IsRunning () const
 Check if asynchronous function is still running.
 
void SetCallbackOnFinish (const std::function< void(T)> &func)
 Set callback which will be called via PollEvents after asynchronous function is finished.
 
- Public Member Functions inherited from utils::EventHandler
virtual void PollEvents ()
 Request to process all registered events.
 

Additional Inherited Members

- Protected Types inherited from utils::EventHandler
using EventId = std::string
 Unique identifier of event.
 
- Protected Member Functions inherited from utils::EventHandler
virtual void ProcessEvent ([[maybe_unused]] const Event *e)
 Process a single event during polling.
 
template<typename T = Event, typename... Args>
void RegisterEvent (Args... args)
 Adds new event to the event queue.
 

Detailed Description

template<typename T>
class utils::ConcurrentBinding< T >

Controller for binding asynchronous processes.

Any function bound to Run function of this class will be executed asynchronously, and checked for finishing. Class can automatically notify user about finishing using PollEvents function of EventHandler super class.