Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 ctru-rs/examples/futures-basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn main() {

let (exit_sender, mut exit_receiver) = futures::channel::oneshot::channel();
let (mut timer_sender, mut timer_receiver) = futures::channel::mpsc::channel(0);
let executor_thread = ctru::thread::Builder::new()
let executor_thread = std::thread::Builder::new()
.affinity(1)
.spawn(move || {
let mut executor = futures::executor::LocalPool::new();
Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/futures-tokio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn main() {
.build()
.expect("Couldn't build runtime");

let runtime_thread = ctru::thread::Builder::new()
let runtime_thread = std::thread::Builder::new()
// Run on the system core
.affinity(1)
// Use a bigger stack size. Default is 0x1000 but we'd easily overflow that.
Expand Down
7 changes: 3 additions & 4 deletions ctru-rs/examples/thread-basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use ctru::console::Console;
use ctru::gfx::Gfx;
use ctru::services::apt::Apt;
use ctru::services::hid::{Hid, KeyPad};
use ctru::thread;

use std::time::Duration;

Expand All @@ -14,19 +13,19 @@ fn main() {
let gfx = Gfx::default();
let _console = Console::init(gfx.top_screen.borrow_mut());

let prio = thread::current().priority();
let prio = ctru::thread::priority();
Comment thread
AzureMarker marked this conversation as resolved.
Outdated
println!("Main thread prio: {}\n", prio);

for ix in 0..3 {
thread::Builder::new()
std::thread::Builder::new()
.priority(prio - 1)
.spawn(move || {
let sleep_duration: u64 = 1000 + ix * 250;
let mut i = 0;
loop {
println!("Thread{ix} says {i}");
i += 1;
thread::sleep(Duration::from_millis(sleep_duration));
std::thread::sleep(Duration::from_millis(sleep_duration));
}
})
.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/thread-locals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn main() {
println!("Value on main thread after mutation: {}", local.borrow());
});

ctru::thread::Builder::new()
std::thread::Builder::new()
.affinity(1)
.spawn(move || {
MY_LOCAL.with(|local| {
Expand Down
4 changes: 2 additions & 2 deletions ctru-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ pub fn init() {

use std::panic::PanicInfo;

let main_thread = thread::current().id();
let main_thread = std::thread::current().id();

// Panic Hook setup
let default_hook = std::panic::take_hook();
let new_hook = Box::new(move |info: &PanicInfo| {
default_hook(info);

// Only for panics in the main thread
if main_thread == thread::current().id() && console::Console::exists() {
if main_thread == std::thread::current().id() && console::Console::exists() {
println!("\nPress SELECT to exit the software");
let hid = services::hid::Hid::init().unwrap();

Expand Down
5 changes: 0 additions & 5 deletions ctru-rs/src/test_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,4 @@ mod link_fix {
extern "C" fn sigemptyset(_arg1: *mut libc::sigset_t) -> ::libc::c_int {
-1
}

#[no_mangle]
extern "C" fn sysconf(_name: libc::c_int) -> libc::c_long {
-1
}
}
Loading