diff options
| author | Valerii Hiora <valerii.hiora@gmail.com> | 2014-06-13 10:18:12 +0300 |
|---|---|---|
| committer | Valerii Hiora <valerii.hiora@gmail.com> | 2014-06-13 10:18:12 +0300 |
| commit | ebc6474668ec60cc793af0f48143bf33d984deb4 (patch) | |
| tree | 5e03b151befb417b1d5262b45ce19a69b4fe5651 /src/libstd/rt | |
| parent | 70a79a9e0527fab74d8c2d2b49886b41bdd878f5 (diff) | |
| download | rust-ebc6474668ec60cc793af0f48143bf33d984deb4.tar.gz rust-ebc6474668ec60cc793af0f48143bf33d984deb4.zip | |
Cosmetic fixes & comments
Diffstat (limited to 'src/libstd/rt')
| -rw-r--r-- | src/libstd/rt/backtrace.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libstd/rt/backtrace.rs b/src/libstd/rt/backtrace.rs index 16b598b3ae7..0e3e7cc796a 100644 --- a/src/libstd/rt/backtrace.rs +++ b/src/libstd/rt/backtrace.rs @@ -248,6 +248,11 @@ mod imp { /// _Unwind_Backtrace is even not available there. Still, /// backtraces could be extracted using a backtrace function, /// which thanks god is public + /// + /// As mentioned in a huge comment block above, backtrace doesn't + /// play well with green threads, so while it is extremely nice + /// and simple to use it should be used only on iOS devices as the + /// only viable option. #[cfg(target_os = "ios", target_arch = "arm")] #[inline(never)] pub fn write(w: &mut Writer) -> IoResult<()> { @@ -267,9 +272,9 @@ mod imp { try!(writeln!(w, "stack backtrace:")); // 100 lines should be enough - static size: libc::c_int = 100; - let mut buf: [*libc::c_void, ..size] = unsafe {mem::zeroed()}; - let cnt = unsafe { backtrace(buf.as_mut_ptr(), size) as uint}; + static SIZE: libc::c_int = 100; + let mut buf: [*libc::c_void, ..SIZE] = unsafe {mem::zeroed()}; + let cnt = unsafe { backtrace(buf.as_mut_ptr(), SIZE) as uint}; // skipping the first one as it is write itself result::fold_(range(1, cnt).map(|i| { |
