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

◆ on_eval()

MAYAFLUX_HOST_API ObserverId MayaFlux::Host::on_eval ( EvalObserver observer)

Observe every evaluation in the session, whoever sent it.

The observer receives a report for each block this process evaluates, including the blocks staged before start_session, and for each block a client sends, whether it succeeded or failed. EvalOrigin tells them apart. It runs on the thread that evaluated, which for a client is the listener's thread, so it must not block, and an exception that escapes it is logged and dropped. Observers can be added before the session starts and outlive it.

Parameters
observerCalled with each report.
Returns
An id for remove_eval_observer.

Definition at line 347 of file Session.cpp.

348{
349 const ObserverId id = g_next_observer.fetch_add(1);
350 const auto held = std::make_shared<const EvalObserver>(std::move(observer));
351 g_observers.update([&](std::vector<ObserverEntry>& entries) {
352 entries.push_back({ .id = id, .observer = held });
353 });
354 return id;
355}
uint64_t ObserverId
Identifies an observer for remove_eval_observer.
Definition Session.hpp:92