Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the Reactor to its own module #413

Merged
merged 1 commit into from
Sep 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion glommio/src/channels/shared_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use crate::{
channels::spsc_queue::{make, BufferHalf, Consumer, Producer},
enclose,
parking::Reactor,
reactor::Reactor,
sys::{self, SleepNotifier},
GlommioError,
Local,
Expand Down
7 changes: 4 additions & 3 deletions glommio/src/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ use scoped_tls::scoped_thread_local;
use crate::{
error::BuilderErrorKind,
parking,
reactor,
sys,
task::{self, waker_fn::dummy_waker},
GlommioError,
Expand Down Expand Up @@ -852,7 +853,7 @@ pub struct LocalExecutor {
queues: Rc<RefCell<ExecutorQueues>>,
parker: parking::Parker,
id: usize,
reactor: Rc<parking::Reactor>,
reactor: Rc<reactor::Reactor>,
}

impl LocalExecutor {
Expand Down Expand Up @@ -899,7 +900,7 @@ impl LocalExecutor {
queues: Rc::new(RefCell::new(queues)),
parker: p,
id: notifier.id(),
reactor: Rc::new(parking::Reactor::new(notifier, io_memory)),
reactor: Rc::new(reactor::Reactor::new(notifier, io_memory)),
})
}

Expand Down Expand Up @@ -1389,7 +1390,7 @@ impl<T> Task<T> {
}

#[inline]
pub(crate) fn get_reactor() -> Rc<parking::Reactor> {
pub(crate) fn get_reactor() -> Rc<reactor::Reactor> {
LOCAL_EX.with(|local_ex| local_ex.get_reactor())
}

Expand Down
2 changes: 1 addition & 1 deletion glommio/src/io/buffered_file_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use crate::{
io::{BufferedFile, ScheduledSource},
parking::Reactor,
reactor::Reactor,
sys::{IoBuffer, Source},
Local,
};
Expand Down
2 changes: 1 addition & 1 deletion glommio/src/io/glommio_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2020 Datadog, Inc.
//

use crate::{io::sched::FileScheduler, parking::Reactor, sys, GlommioError, Local};
use crate::{io::sched::FileScheduler, reactor::Reactor, sys, GlommioError, Local};
use log::debug;
use std::{
cell::{Ref, RefCell},
Expand Down
3 changes: 2 additions & 1 deletion glommio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ extern crate lazy_static;
#[macro_use(defer)]
extern crate scopeguard;

use crate::parking::Reactor;
use crate::reactor::Reactor;
use std::{fmt::Debug, time::Duration};

/// Call `Waker::wake()` and log to `error` if panicked.
Expand All @@ -319,6 +319,7 @@ mod free_list;
#[allow(clippy::upper_case_acronyms)]
mod iou;
mod parking;
mod reactor;
mod sys;
pub mod task;

Expand Down
2 changes: 1 addition & 1 deletion glommio/src/net/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2020 Datadog, Inc.
//
use crate::{
parking::Reactor,
reactor::Reactor,
sys::{self, DmaBuffer, Source, SourceType},
ByteSliceMutExt,
Local,
Expand Down
2 changes: 1 addition & 1 deletion glommio/src/net/tcp_socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2020 Datadog, Inc.
//
use super::stream::GlommioStream;
use crate::{net::yolo_accept, parking::Reactor, GlommioError, Local};
use crate::{net::yolo_accept, reactor::Reactor, GlommioError, Local};
use futures_lite::{
future::poll_fn,
io::{AsyncBufRead, AsyncRead, AsyncWrite},
Expand Down
2 changes: 1 addition & 1 deletion glommio/src/net/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2020 Datadog, Inc.
//
use super::{datagram::GlommioDatagram, stream::GlommioStream};
use crate::{parking::Reactor, Local};
use crate::{reactor::Reactor, Local};
use futures_lite::{
future::poll_fn,
io::{AsyncBufRead, AsyncRead, AsyncWrite},
Expand Down
2 changes: 1 addition & 1 deletion glommio/src/nop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{
rc::{Rc, Weak},
};

use crate::{parking::Reactor, Local};
use crate::{reactor::Reactor, Local};

/// Submit no-op operations to io_uring.
///
Expand Down
Loading