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

Introduce the Tokio runtime: Reactor + Threadpool #141

Merged
merged 28 commits into from Feb 21, 2018
Commits
Jump to file or symbol
Failed to load files and symbols.
+6,314 −936
Diff settings

Always

Just for now

View
@@ -23,20 +23,24 @@ keywords = ["io", "async", "non-blocking", "futures"]
members = [
"./",
"tokio-executor",
"tokio-io",
"tokio-threadpool",
]
[badges]
travis-ci = { repository = "tokio-rs/tokio" }
appveyor = { repository = "carllerche/tokio" }
[dependencies]
tokio-io = "0.1"

This comment has been minimized.

@kpp

kpp Feb 15, 2018

Contributor

Why do you set path in tokio-executor like path = "tokio-executor" but you get tokio-io from crates.io?

This comment has been minimized.

@carllerche

carllerche Feb 15, 2018

Member

The tokio-io dependency probably should be updated as well 👍 That can be done on master.

tokio-executor = { version = "0.1", path = "tokio-executor" }
tokio-threadpool = { version = "0.1", path = "tokio-threadpool" }
bytes = "0.4"
log = "0.4"
mio = "0.6.13"
slab = "0.4"
iovec = "0.1"
tokio-io = "0.1"
futures = "0.1.16"
[dev-dependencies]
View
@@ -439,6 +439,8 @@ pub fn main() {
println!("accept error = {:?}", err);
});
println!("server running on localhost:6142");
// This starts the `current_thread` executor.
//
// Executors are responsible for scheduling many asynchronous tasks, driving
@@ -447,19 +449,16 @@ pub fn main() {
//
// The `current_thread` executor multiplexes all scheduled tasks on the
// current thread. This means that spawned tasks must not implement `Send`.
current_thread::run(|_| {
// Now, the server task must be spawned.
// It's important to note that all futures / tasks are lazy. No work will
// happen unless they are spawned onto an executor.
//
// It's important to note that all futures / tasks are lazy. No work
// will happen unless they are spawned onto an executor.
current_thread::spawn(server);
println!("server running on localhost:6142");
// The `current_thread::run` function will now block until *all* spawned
// tasks complete.
// The executor will start running the `server` task, which, in turn, spawns
// new tasks for each incoming connection.
//
// In our example, we have not defined a shutdown strategy, so
// this will block until `ctrl-c` is pressed at the terminal.
});
// The `current_thread::block_on_all` function will block until *all*
// spawned tasks complete.
//
// In our example, we have not defined a shutdown strategy, so this will
// block until `ctrl-c` is pressed at the terminal.
current_thread::block_on_all(server).unwrap();
}
View
@@ -55,28 +55,26 @@ pub fn main() {
println!("accept error = {:?}", err);
});
println!("server running on localhost:6142");
// This starts the `current_thread` executor.
//
// Executors are responsible for scheduling many asynchronous tasks, driving
// them to completion. There are a number of different executor
// implementations, each providing different scheduling characteristics.
//
// The `current_thread` executor multiplexes all scheduled tasks on the
// current thread. This means that spawned tasks are not required to
// implement `Send`.
current_thread::run(|_| {
// Now, the server task must be spawned.
// current thread. This means that spawned tasks must not implement `Send`.

This comment has been minimized.

@stjepang

stjepang Jun 16, 2018

Collaborator

Wasn't the old wording correct - "spawned tasks are not required to implement Send"? :)

This comment has been minimized.

@carllerche

carllerche Jun 18, 2018

Member

You are correct!

This comment has been minimized.

@carllerche

carllerche Jun 18, 2018

Member

Well, the good news is it has been fixed on master it looks like.

// It's important to note that all futures / tasks are lazy. No work will
// happen unless they are spawned onto an executor.
//
// It's important to note that all futures / tasks are lazy. No work
// will happen unless they are spawned onto an executor.
current_thread::spawn(server);
println!("server running on localhost:6142");
// The `current_thread::run` function will now block until *all* spawned
// tasks complete.
// The executor will start running the `server` task, which, in turn, spawns
// new tasks for each incoming connection.
//
// In our example, we have not defined a shutdown strategy, so
// this will block until `ctrl-c` is pressed at the terminal.
});
// The `current_thread::block_on_all` function will block until *all*
// spawned tasks complete.
//
// In our example, we have not defined a shutdown strategy, so this will
// block until `ctrl-c` is pressed at the terminal.
current_thread::block_on_all(server).unwrap();
}
Oops, something went wrong.
ProTip! Use n and p to navigate between commits in a pull request.