Skip to content

Commit

Permalink
auto merge of #13457 : alexcrichton/rust/issue-13420, r=thestinger
Browse files Browse the repository at this point in the history
On some OSes (such as freebsd), pthread_attr_init allocates memory, so this is
necessary to deallocate that memory.

Closes #13420
  • Loading branch information
bors committed Apr 11, 2014
2 parents 9af93ad + 11c9871 commit 1b37afe
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/libstd/rt/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ mod imp {
let arg: *libc::c_void = cast::transmute(p);
assert_eq!(pthread_create(&mut native, &attr,
super::thread_start, arg), 0);
assert_eq!(pthread_attr_destroy(&mut attr), 0);
native
}

Expand Down Expand Up @@ -303,6 +304,7 @@ mod imp {
fn pthread_join(native: libc::pthread_t,
value: **libc::c_void) -> libc::c_int;
fn pthread_attr_init(attr: *mut libc::pthread_attr_t) -> libc::c_int;
fn pthread_attr_destroy(attr: *mut libc::pthread_attr_t) -> libc::c_int;
fn pthread_attr_setstacksize(attr: *mut libc::pthread_attr_t,
stack_size: libc::size_t) -> libc::c_int;
fn pthread_attr_setdetachstate(attr: *mut libc::pthread_attr_t,
Expand Down

0 comments on commit 1b37afe

Please sign in to comment.