MayaFlux 0.5.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 145 of file SpatialTransfer.cpp.

146{
147 if (!m_state || !m_state->recording.load(std::memory_order_acquire)) {
148 return;
149 }
150
151 m_state->stop_requested.store(true, std::memory_order_release);
153
155 "SpatialCapture: stop requested after {} frames",
156 m_state->frame.load(std::memory_order_relaxed));
157}
#define MF_INFO(comp, ctx,...)
std::shared_ptr< CaptureState > m_state
Vruta::TaskScheduler & m_scheduler
bool cancel_task(const std::shared_ptr< Routine > &routine)
Cancels and removes a task from the scheduler.
@ FileIO
Filesystem I/O operations.
@ IO
Networking, file handling, streaming.

References MayaFlux::Vruta::TaskScheduler::cancel_task(), MayaFlux::Journal::FileIO, MayaFlux::Journal::IO, m_scheduler, m_state, m_task_name, and MF_INFO.

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

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