mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-28 04:50:30 +00:00
d39aabe054
Subtasks are used when current async processing needs to execute a `Future` via a sync function (eg. a call to a C function). In this case `Context::block_on` would block the whole `Context`, leading to a deadlock. The main use case for this is the `Pad{Src,Sink}` functions: when we `PadSrc::push` and the peer pad is a `PadSink`, we want `PadSrc::push` to complete after the async function on the `PadSink` completes. In this case the `PadSink` async function is added as a subtask of current scheduler task and `PadSrc::push` only returns when the subtask is executed. In `runtime::Task` (`Task` here is the execution Task with a state machine, not a scheduler task), we used to spawn state transition actions and iteration loop (leading to a new scheduler Task). At the time, it seemed convenient for the user to automatically drain sub tasks after a state transition action or an iteration. User wouldn't have to worry about this, similarly to the `Pad{Src,Sink}` case. In current implementation, the `Task` state machine now operates directly on the target `Context`. State transtions actions and the iteration loop are no longer spawned. It seems now useless to abstract the subtasks draining from the user. Either they transitively use a mechanism such as `Pad{Src,Sink}` which already handles this automatically, or they add substasks on purpose, in which case they know better when subtasks must be drained. |
||
---|---|---|
.. | ||
file | ||
fmp4 | ||
sodium | ||
threadshare |