ts/Task: spawn StateMachine on ts Context

Task state machines used to execute in an executor from the Futures
crate. State transitions actions and iteration functions were then
spawned on the target threadshare Context.

This commit directly spawns the task state machine on the threadshare
Context. This simplifies code a bit and paves the way for the changes
described in [1].

Also introduces struct `StateMachineHandle`, which gather together
fields to communicate and synchronize with the StateMachine. Renamed
`StateMachine::run` as `spawn` and return `StateMachineHandle`.

[1]: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/793#note_1464400
This commit is contained in:
François Laignel 2022-07-26 09:23:52 +02:00
parent 0858dfedb4
commit 625fce3934
2 changed files with 566 additions and 566 deletions

View file

@ -9,10 +9,10 @@ edition = "2021"
rust-version = "1.57" rust-version = "1.57"
[dependencies] [dependencies]
async-task = "4.0.3" async-task = "4.3.0"
concurrent-queue = "1.2.2" concurrent-queue = "1.2.2"
flume = "0.10.13" flume = "0.10.13"
futures = { version = "0.3.17", features = ["thread-pool"] } futures = "0.3.21"
libc = "0.2" libc = "0.2"
gio = { git = "https://github.com/gtk-rs/gtk-rs-core" } gio = { git = "https://github.com/gtk-rs/gtk-rs-core" }
gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
@ -22,7 +22,7 @@ once_cell = "1"
pin-project-lite = "0.2.0" pin-project-lite = "0.2.0"
polling = "2.2.0" polling = "2.2.0"
rand = "0.8" rand = "0.8"
slab = "0.4.2" slab = "0.4.7"
socket2 = {features = ["all"], version = "0.4"} socket2 = {features = ["all"], version = "0.4"}
waker-fn = "1.1" waker-fn = "1.1"

File diff suppressed because it is too large Load diff