Skip to content
Snippets Groups Projects
Commit 780e6ff8 authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Merge branch 'fix_pthread_cancel' into 'master'

Fix thread cleanup after main exits.

See merge request redox-os/relibc!439
parents 50c5ce2f b2385367
No related branches found
No related tags found
No related merge requests found
......@@ -188,7 +188,8 @@ pub unsafe extern "C" fn tcflow(fd: c_int, action: c_int) -> c_int {
#[no_mangle]
pub unsafe extern "C" fn cfmakeraw(termios_p: *mut termios) {
(*termios_p).c_iflag &= !(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON) as u32;
(*termios_p).c_iflag &=
!(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON) as u32;
(*termios_p).c_oflag &= !OPOST as u32;
(*termios_p).c_lflag &= !(ECHO | ECHONL | ICANON | ISIG | IEXTEN) as u32;
(*termios_p).c_cflag &= !(CSIZE | PARENB) as u32;
......
......@@ -254,8 +254,6 @@ pub unsafe fn join(thread: &Pthread) -> Result<Retval, Errno> {
// pthread_t of this thread, will no longer be valid. In practice, we can thus deallocate the
// thread state.
OS_TID_TO_PTHREAD.lock().remove(&thread.os_tid.get().read());
dealloc_thread(thread);
Ok(retval)
......@@ -311,6 +309,7 @@ pub unsafe fn exit_current_thread(retval: Retval) -> ! {
// On the other hand, there can be at most two strong references to each thread (OS_TID_TO_PTHREAD
// and PTHREAD_SELF), so maybe Arc is unnecessary except from being memory-safe.
unsafe fn dealloc_thread(thread: &Pthread) {
OS_TID_TO_PTHREAD.lock().remove(&thread.os_tid.get().read());
drop(Box::from_raw(thread as *const Pthread as *mut Pthread));
}
pub const SIGRT_RLCT_CANCEL: usize = 32;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment