File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -925,6 +925,11 @@ pub unsafe extern "C" fn _rust_glue_entry(native_app: *mut ffi::android_app) {
925
925
} ;
926
926
927
927
unsafe {
928
+ // Name thread - this needs to happen here after attaching to a JVM thread,
929
+ // since that changes the thread name to something like "Thread-2".
930
+ let thread_name = std:: ffi:: CStr :: from_bytes_with_nul ( b"android_main\0 " ) . unwrap ( ) ;
931
+ libc:: pthread_setname_np ( libc:: pthread_self ( ) , thread_name. as_ptr ( ) ) ;
932
+
928
933
let app = AndroidApp :: from_ptr ( NonNull :: new ( native_app) . unwrap ( ) , jvm. clone ( ) ) ;
929
934
930
935
// We want to specifically catch any panic from the application's android_main
Original file line number Diff line number Diff line change @@ -868,6 +868,11 @@ extern "C" fn ANativeActivity_onCreate(
868
868
rust_glue. notify_main_thread_running ( ) ;
869
869
870
870
unsafe {
871
+ // Name thread - this needs to happen here after attaching to a JVM thread,
872
+ // since that changes the thread name to something like "Thread-2".
873
+ let thread_name = std:: ffi:: CStr :: from_bytes_with_nul ( b"android_main\0 " ) . unwrap ( ) ;
874
+ libc:: pthread_setname_np ( libc:: pthread_self ( ) , thread_name. as_ptr ( ) ) ;
875
+
871
876
// We want to specifically catch any panic from the application's android_main
872
877
// so we can finish + destroy the Activity gracefully via the JVM
873
878
catch_unwind ( || {
You can’t perform that action at this time.
0 commit comments