Move unique_thread_exit call to lang_start_internal so it is not in a… · model-checking/verify-rust-std@079f999

Original file line numberDiff line numberDiff line change

@@ -144,6 +144,10 @@ fn lang_start_internal(

144144

rtabort!("drop of the panic payload panicked");

145145

});

146146

panic::catch_unwind(cleanup).map_err(rt_abort)?;

147+

// Guard against multple threads calling `libc::exit` concurrently.

148+

// See the documentation for `unique_thread_exit` for more information.

149+

panic::catch_unwind(|| crate::sys::common::exit_guard::unique_thread_exit())

150+

.map_err(rt_abort)?;

147151

ret_code

148152

}

149153

@@ -161,8 +165,5 @@ fn lang_start<T: crate::process::Termination + 'static>(

161165

argv,

162166

sigpipe,

163167

);

164-

// Guard against multple threads calling `libc::exit` concurrently.

165-

// See the documentation for `unique_thread_exit` for more information.

166-

crate::sys::common::exit_guard::unique_thread_exit();

167168

v

168169

}