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

Upgrade to tokio 1.0 #215

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,14 @@ features = [
]

[dependencies.tokio]
version = "0.2"
version = "1.0"
default-features = false
features = [
"process",
"io-std",
"io-util",
"rt-threaded",
"blocking",
"rt-multi-thread",
"sync",
"stream",
"time",
"macros",
]
Expand Down
2 changes: 1 addition & 1 deletion src/async_turtle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl AsyncTurtle {
return;
}

time::delay_for(time::Duration::from_millis((secs * 1000.0) as u64)).await
time::sleep(time::Duration::from_millis((secs * 1000.0) as u64)).await
}

pub async fn arc_left(&mut self, radius: Distance, extent: Angle) {
Expand Down
2 changes: 1 addition & 1 deletion src/ipc_protocol/async_ipc_receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl<T: Serialize + DeserializeOwned + Send + 'static> AsyncIpcReceiver<T> {
// disconnected. This allows callers of `recv` to detect the disconnection.
let next_value = ipc_receiver.recv();

let value_sender: oneshot::Sender<_> = match handle.block_on(receiver.recv()) {
let value_sender: oneshot::Sender<_> = match receiver.blocking_recv() {
Some(value_sender) => value_sender,
// The sender for this channel only drops when the main thread has stopped,
// so it's pretty safe to stop here
Expand Down
2 changes: 1 addition & 1 deletion src/renderer_server/animation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ async fn animation_loop(
},

// Trigger an update once the next update time has elapsed
_ = time::delay_until(next_update) => {
_ = time::sleep_until(next_update) => {
let now = time::Instant::now();

handle_handler_result(update_animations(
Expand Down
2 changes: 1 addition & 1 deletion src/renderer_server/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ pub fn run_main(
GlutinEvent::LoopDestroyed => {
// Notify the server that it should shutdown, ignoring the error if the channel has
// been dropped since that just means that the server task has ended already
handle.block_on(server_shutdown.send(())).unwrap_or(());
server_shutdown.blocking_send(()).unwrap_or(());
},

_ => {},
Expand Down