From b8dd44198e9a1fe128b52d0d00c579e3af3af2ed Mon Sep 17 00:00:00 2001 From: Yoh Deadfall Date: Sat, 5 Oct 2024 21:29:40 +0300 Subject: [PATCH] Android: Debug assertion after setting thread name --- std/src/sys/pal/unix/thread.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/std/src/sys/pal/unix/thread.rs b/std/src/sys/pal/unix/thread.rs index 2f2d6e6add396..040246618360f 100644 --- a/std/src/sys/pal/unix/thread.rs +++ b/std/src/sys/pal/unix/thread.rs @@ -117,13 +117,15 @@ impl Thread { pub fn set_name(name: &CStr) { const PR_SET_NAME: libc::c_int = 15; unsafe { - libc::prctl( + let res = libc::prctl( PR_SET_NAME, name.as_ptr(), 0 as libc::c_ulong, 0 as libc::c_ulong, 0 as libc::c_ulong, ); + // We have no good way of propagating errors here, but in debug-builds let's check that this actually worked. + debug_assert_eq!(res, 0); } }