Android: Debug assertion after setting thread name · qinheping/verify-rust-std@b8dd441 (original) (raw)

Original file line number Diff line number Diff line change
@@ -117,13 +117,15 @@ impl Thread {
117 117 pub fn set_name(name: &CStr) {
118 118 const PR_SET_NAME: libc::c_int = 15;
119 119 unsafe {
120 - libc::prctl(
120 +let res = libc::prctl(
121 121 PR_SET_NAME,
122 122 name.as_ptr(),
123 123 0 as libc::c_ulong,
124 124 0 as libc::c_ulong,
125 125 0 as libc::c_ulong,
126 126 );
127 +// We have no good way of propagating errors here, but in debug-builds let's check that this actually worked.
128 +debug_assert_eq!(res, 0);
127 129 }
128 130 }
129 131