Skip to content

Commit

Permalink
Rollup merge of rust-lang#68767 - kubo39:patch-macos, r=shepmaster
Browse files Browse the repository at this point in the history
macOS: avoid calling pthread_self() twice
  • Loading branch information
JohnTitor authored Feb 16, 2020
2 parents e4192ac + 67068f3 commit 4d2a325
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/libstd/sys/unix/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,9 @@ pub mod guard {

#[cfg(target_os = "macos")]
unsafe fn get_stack_start() -> Option<*mut libc::c_void> {
let stackaddr = libc::pthread_get_stackaddr_np(libc::pthread_self()) as usize
- libc::pthread_get_stacksize_np(libc::pthread_self());
let th = libc::pthread_self();
let stackaddr =
libc::pthread_get_stackaddr_np(th) as usize - libc::pthread_get_stacksize_np(th);
Some(stackaddr as *mut libc::c_void)
}

Expand Down

0 comments on commit 4d2a325

Please sign in to comment.