mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-02-02 14:12:20 +00:00
threadshare: Move to tokio_threadpool and tokio_current_thread crates
This commit is contained in:
parent
23b25b210b
commit
987f78de42
3 changed files with 7 additions and 5 deletions
|
@ -16,6 +16,7 @@ tokio-reactor = { git = "https://github.com/tokio-rs/tokio" }
|
|||
tokio-executor = { git = "https://github.com/tokio-rs/tokio" }
|
||||
tokio-timer = { git = "https://github.com/tokio-rs/tokio" }
|
||||
tokio-threadpool = { git = "https://github.com/tokio-rs/tokio" }
|
||||
tokio-current-thread = { git = "https://github.com/tokio-rs/tokio" }
|
||||
futures = "0.1"
|
||||
lazy_static = "1.0"
|
||||
either = "1.0"
|
||||
|
|
|
@ -26,7 +26,7 @@ use futures::future;
|
|||
use futures::stream::futures_unordered::FuturesUnordered;
|
||||
use futures::sync::oneshot;
|
||||
use futures::{Future, Stream};
|
||||
use tokio::executor::thread_pool;
|
||||
use tokio_threadpool;
|
||||
use tokio::reactor;
|
||||
use tokio_timer::timer;
|
||||
|
||||
|
@ -124,13 +124,13 @@ impl IOContextRunner {
|
|||
gst_debug!(CONTEXT_CAT, "Started reactor thread '{}'", self.name);
|
||||
|
||||
if let Some(ref pending_futures) = self.pending_futures {
|
||||
use tokio::executor::current_thread;
|
||||
use tokio_current_thread;
|
||||
|
||||
let handle = reactor.handle();
|
||||
let mut enter = ::tokio_executor::enter().unwrap();
|
||||
let timer = timer::Timer::new(reactor);
|
||||
let timer_handle = timer.handle();
|
||||
let mut current_thread = current_thread::CurrentThread::new_with_park(timer);
|
||||
let mut current_thread = tokio_current_thread::CurrentThread::new_with_park(timer);
|
||||
|
||||
::tokio_reactor::with_default(&handle, &mut enter, |mut enter| {
|
||||
::tokio_timer::with_default(&timer_handle, &mut enter, |enter| loop {
|
||||
|
@ -245,7 +245,7 @@ pub struct IOContext(Arc<IOContextInner>);
|
|||
|
||||
struct IOContextInner {
|
||||
name: String,
|
||||
pool: Either<thread_pool::ThreadPool, IOContextExecutor>,
|
||||
pool: Either<tokio_threadpool::ThreadPool, IOContextExecutor>,
|
||||
handle: reactor::Handle,
|
||||
// Only used for dropping
|
||||
_shutdown: IOContextShutdown,
|
||||
|
@ -284,7 +284,7 @@ impl IOContext {
|
|||
let shutdown = IOContextRunner::start(name, wait, reactor);
|
||||
|
||||
// FIXME: The executor threads are not throttled at all, only the reactor
|
||||
let mut pool_builder = thread_pool::Builder::new();
|
||||
let mut pool_builder = tokio_threadpool::Builder::new();
|
||||
pool_builder
|
||||
.around_worker(move |w, enter| {
|
||||
let timer_handle = t1.lock().unwrap().get(w.id()).unwrap().clone();
|
||||
|
|
|
@ -32,6 +32,7 @@ extern crate tokio;
|
|||
extern crate tokio_executor;
|
||||
extern crate tokio_reactor;
|
||||
extern crate tokio_threadpool;
|
||||
extern crate tokio_current_thread;
|
||||
extern crate tokio_timer;
|
||||
|
||||
extern crate either;
|
||||
|
|
Loading…
Reference in a new issue