gst-plugins-rs/generic/threadshare
François Laignel 8b54c3fed6 ts/Task: split iterate into try_next and handle_item
Previous Task iteration model suffered from the following
shortcomings:

- When an iteration was engaged it could be cancelled at
  await points by Stop or Flush state transitions,
  which could lead to inconsistent states.
- When an iteration was engaged it could not be cancelled
  by a Pause state transition so as to prevent data loss.
  This meant we couldn't block on the Pause request because
  the mechanism couldn't guarantee Paused would be reached
  in a timely manner.

This commit split the Task iteration into:

- `try_next`: this function returns a future that awaits
  for a new iteration to begin. The regular use case is
  to return an item to process. The item can be left to
  `()` if `try_next` acts as a tick generator. It can
  also return an error. This function can be cancelled at
  await points when a state transition request occurs.
- `handle_item`: this function is called with the item
  returned by `try_next` and is guaranteed to run to
  completion even if a transition request is received.

Note that this model plays well with the common Future
cancellation pitfalls in Rust.
2022-08-10 20:02:53 +02:00
..
examples Fix/silence a couple new clippy warnings 2022-06-30 16:07:32 +03:00
src ts/Task: split iterate into try_next and handle_item 2022-08-10 20:02:53 +02:00
tests ts: update elements for new TransitionStatus 2022-08-09 19:48:06 +02:00
build.rs fix-getters-calls 0.3.0 pass 2021-04-20 18:19:58 +02:00
Cargo.toml ts/Task: spawn StateMachine on ts Context 2022-08-09 19:48:06 +02:00
LICENSE-LGPLv2 Add LICENSE files to each individual crate 2020-07-10 13:06:28 +03:00