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

◆ stop()

void MayaFlux::IO::SpatialCapture::stop ( )

Request the capture routine stop.

Frames already written are kept.

Only sets a stop flag and asks the scheduler to drop the task; returns immediately without waiting for the routine's coroutine to actually observe it and exit, since that resumption happens on the graphics thread on its own schedule. This is what makes it safe to call from any thread, including inside ~SpatialCapture(): the state the coroutine reads (CaptureState) is reference-counted independently of this object, so a SpatialCapture destroyed the instant stop() returns never leaves the still-running coroutine touching freed memory.

Definition at line 146 of file SpatialTransfer.cpp.

147{
148 if (!m_state || !m_state->recording.load(std::memory_order_acquire)) {
149 return;
150 }
151
152 m_state->stop_requested.store(true, std::memory_order_release);
153 m_scheduler.cancel_task(m_task_name);
154
156 "SpatialCapture: stop requested after {} frames",
157 m_state->frame.load(std::memory_order_relaxed));
158}
#define MF_INFO(comp, ctx,...)
std::shared_ptr< CaptureState > m_state
Vruta::TaskScheduler & m_scheduler
@ FileIO
Filesystem I/O operations.
@ IO
Networking, file handling, streaming.

References MayaFlux::Journal::FileIO, MayaFlux::Journal::IO, m_scheduler, m_state, m_task_name, and MF_INFO.

Referenced by operator=(), start(), and ~SpatialCapture().

Here is the caller graph for this function: