Rename threads

This commit is contained in:
Fredrik Fornwall
2023-11-20 12:48:37 +01:00
parent c2f467c174
commit d9af67008a
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -926,7 +926,7 @@ pub unsafe extern "C" fn _rust_glue_entry(native_app: *mut ffi::android_app) {
};
thread::Builder::new()
.name("android-stdio".to_string())
.name("stdio-to-logcat".to_string())
.spawn(move || {
let tag = CStr::from_bytes_with_nul(b"RustStdoutStderr\0").unwrap();
let mut reader = BufReader::new(file);
@@ -960,7 +960,7 @@ pub unsafe extern "C" fn _rust_glue_entry(native_app: *mut ffi::android_app) {
unsafe {
// Name thread - this needs to happen here after attaching to a JVM thread,
// since that changes the thread name to something like "Thread-2".
let thread_name = CStr::from_bytes_with_nul(b"android-main\0").unwrap();
let thread_name = CStr::from_bytes_with_nul(b"android_main\0").unwrap();
libc::pthread_setname_np(libc::pthread_self(), thread_name.as_ptr());
let app = AndroidApp::from_ptr(NonNull::new(native_app).unwrap(), jvm.clone());
+2 -2
View File
@@ -846,7 +846,7 @@ extern "C" fn ANativeActivity_onCreate(
};
std::thread::Builder::new()
.name("android-stdio".to_string())
.name("stdio-to-logcat".to_string())
.spawn(move || {
let tag = CStr::from_bytes_with_nul(b"RustStdoutStderr\0").unwrap();
let mut reader = BufReader::new(file);
@@ -904,7 +904,7 @@ extern "C" fn ANativeActivity_onCreate(
unsafe {
// Name thread - this needs to happen here after attaching to a JVM thread,
// since that changes the thread name to something like "Thread-2".
let thread_name = CStr::from_bytes_with_nul(b"android-main\0").unwrap();
let thread_name = CStr::from_bytes_with_nul(b"android_main\0").unwrap();
libc::pthread_setname_np(libc::pthread_self(), thread_name.as_ptr());
// We want to specifically catch any panic from the application's android_main