Browse Source

Run executor thread on system core

pull/36/head
AzureMarker 3 years ago
parent
commit
c13c1c8c68
No known key found for this signature in database
GPG Key ID: 47A133F3BF9D03D3
  1. 7
      ctru-rs/examples/futures-basic.rs

7
ctru-rs/examples/futures-basic.rs

@ -22,7 +22,9 @@ fn main() {
let (exit_sender, mut exit_receiver) = futures::channel::oneshot::channel(); let (exit_sender, mut exit_receiver) = futures::channel::oneshot::channel();
let (mut timer_sender, mut timer_receiver) = futures::channel::mpsc::channel(0); let (mut timer_sender, mut timer_receiver) = futures::channel::mpsc::channel(0);
let executor_thread = ctru::thread::spawn(move || { let executor_thread = ctru::thread::Builder::new()
.affinity(1)
.spawn(move || {
let mut executor = futures::executor::LocalPool::new(); let mut executor = futures::executor::LocalPool::new();
executor.run_until(async move { executor.run_until(async move {
@ -35,7 +37,8 @@ fn main() {
} }
} }
}); });
}); })
.expect("Failed to create executor thread");
println!("Executor started!"); println!("Executor started!");

Loading…
Cancel
Save