summaryrefslogtreecommitdiffstats
path: root/examples/hello_world.rs
diff options
context:
space:
mode:
authorCarl Lerche <me@carllerche.com>2018-03-06 12:00:49 -0800
committerGitHub <noreply@github.com>2018-03-06 12:00:49 -0800
commit869615f1d220e522af025d52be0b846570fed63d (patch)
treed64b2ba2f2ba56f5c2500d38f5c6187f1e2e487b /examples/hello_world.rs
parentae20270d0010f3f990546bdf2ee284185b85fdbd (diff)
Fix some comments in the examples. (#187)
The PR that updated the examples skipped some comments. This patch updates thhe comments.
Diffstat (limited to 'examples/hello_world.rs')
-rw-r--r--examples/hello_world.rs21
1 files changed, 7 insertions, 14 deletions
diff --git a/examples/hello_world.rs b/examples/hello_world.rs
index d8fef621..398ec11a 100644
--- a/examples/hello_world.rs
+++ b/examples/hello_world.rs
@@ -54,22 +54,15 @@ pub fn main() {
println!("server running on localhost:6142");
- // This starts the `current_thread` executor.
+ // Start the Tokio runtime.
//
- // 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 Tokio is a pre-configured "out of the box" runtime for building
+ // asynchronous applications. It includes both a reactor and a task
+ // scheduler. This means applications are multithreaded by default.
//
- // The `current_thread` executor multiplexes all scheduled tasks on the
- // current thread. This means that spawned tasks must not implement `Send`.
- // It's important to note that all futures / tasks are lazy. No work will
- // happen unless they are spawned onto an executor.
- //
- // The executor will start running the `server` task, which, in turn, spawns
- // new tasks for each incoming connection.
- //
- // The `current_thread::block_on_all` function will block until *all*
- // spawned tasks complete.
+ // This function blocks until the runtime reaches an idle state. Idle is
+ // defined as all spawned tasks have completed and all I/O resources (TCP
+ // sockets in our case) have been dropped.
//
// In our example, we have not defined a shutdown strategy, so this will
// block until `ctrl-c` is pressed at the terminal.