mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-02-02 06:02:20 +00:00
ts/runtime: use a directory for executor module
This will ease the introduction of other concepts which are required for our own executor implementation.
This commit is contained in:
parent
cd0773662f
commit
c5ef83d5b0
2 changed files with 41 additions and 20 deletions
|
@ -1,5 +1,5 @@
|
|||
// Copyright (C) 2018-2020 Sebastian Dröge <sebastian@centricular.com>
|
||||
// Copyright (C) 2019-2020 François Laignel <fengalin@free.fr>
|
||||
// Copyright (C) 2019-2021 François Laignel <fengalin@free.fr>
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
|
@ -16,24 +16,6 @@
|
|||
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
|
||||
// Boston, MA 02110-1335, USA.
|
||||
|
||||
//! The `Executor` for the `threadshare` GStreamer plugins framework.
|
||||
//!
|
||||
//! The [`threadshare`]'s `Executor` consists in a set of [`Context`]s. Each [`Context`] is
|
||||
//! identified by a `name` and runs a loop in a dedicated `thread`. Users can use the [`Context`]
|
||||
//! to spawn `Future`s. `Future`s are asynchronous processings which allow waiting for resources
|
||||
//! in a non-blocking way. Examples of non-blocking operations are:
|
||||
//!
|
||||
//! * Waiting for an incoming packet on a Socket.
|
||||
//! * Waiting for an asynchronous `Mutex` `lock` to succeed.
|
||||
//! * Waiting for a time related `Future`.
|
||||
//!
|
||||
//! `Element` implementations should use [`PadSrc`] & [`PadSink`] which provides high-level features.
|
||||
//!
|
||||
//! [`threadshare`]: ../../index.html
|
||||
//! [`Context`]: struct.Context.html
|
||||
//! [`PadSrc`]: ../pad/struct.PadSrc.html
|
||||
//! [`PadSink`]: ../pad/struct.PadSink.html
|
||||
|
||||
use futures::channel::oneshot;
|
||||
use futures::future::BoxFuture;
|
||||
use futures::prelude::*;
|
||||
|
@ -54,7 +36,7 @@ use std::task::Poll;
|
|||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
use super::RUNTIME_CAT;
|
||||
use crate::runtime::RUNTIME_CAT;
|
||||
|
||||
// We are bound to using `sync` for the `runtime` `Mutex`es. Attempts to use `async` `Mutex`es
|
||||
// lead to the following issues:
|
39
generic/threadshare/src/runtime/executor/mod.rs
Normal file
39
generic/threadshare/src/runtime/executor/mod.rs
Normal file
|
@ -0,0 +1,39 @@
|
|||
// Copyright (C) 2018-2020 Sebastian Dröge <sebastian@centricular.com>
|
||||
// Copyright (C) 2019-2021 François Laignel <fengalin@free.fr>
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Library General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Library General Public
|
||||
// License along with this library; if not, write to the
|
||||
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
|
||||
// Boston, MA 02110-1335, USA.
|
||||
|
||||
//! The `Executor` for the `threadshare` GStreamer plugins framework.
|
||||
//!
|
||||
//! The [`threadshare`]'s `Executor` consists in a set of [`Context`]s. Each [`Context`] is
|
||||
//! identified by a `name` and runs a loop in a dedicated `thread`. Users can use the [`Context`]
|
||||
//! to spawn `Future`s. `Future`s are asynchronous processings which allow waiting for resources
|
||||
//! in a non-blocking way. Examples of non-blocking operations are:
|
||||
//!
|
||||
//! * Waiting for an incoming packet on a Socket.
|
||||
//! * Waiting for an asynchronous `Mutex` `lock` to succeed.
|
||||
//! * Waiting for a time related `Future`.
|
||||
//!
|
||||
//! `Element` implementations should use [`PadSrc`] & [`PadSink`] which provides high-level features.
|
||||
//!
|
||||
//! [`threadshare`]: ../../index.html
|
||||
//! [`PadSrc`]: ../pad/struct.PadSrc.html
|
||||
//! [`PadSink`]: ../pad/struct.PadSink.html
|
||||
|
||||
mod context;
|
||||
pub use context::{
|
||||
block_on, block_on_or_add_sub_task, yield_now, Context, JoinHandle, SubTaskOutput, TaskId,
|
||||
};
|
Loading…
Reference in a new issue