diff options
| author | bors <bors@rust-lang.org> | 2013-03-11 20:21:45 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-03-11 20:21:45 -0700 |
| commit | 48cb9a8ac0b95408a142ea7bc9767414eba2cbb3 (patch) | |
| tree | 2aa22a3dbbdbf2364a41feba5f358dfd3e979574 /src/libcore/rt/stack.rs | |
| parent | a6bb4a0f1a61ab00e09c4cb24dfff95c6c2481c7 (diff) | |
| parent | 676e0290ed4d306e6d7b517de1409c109309a0b2 (diff) | |
| download | rust-48cb9a8ac0b95408a142ea7bc9767414eba2cbb3.tar.gz rust-48cb9a8ac0b95408a142ea7bc9767414eba2cbb3.zip | |
auto merge of #5303 : brson/rust/newsched4, r=brson
r? Followup to #5022. This is the same, but everything is in `core::rt` now. `std::uv_ll` is moved to `core::unstable::uvll`, with the intent that it eventually move into its own crate (blocked on #5192 at least). I've had to disable the uv tests because of #2064. All of `core::rt` is disabled on platforms that aren't mac or linux until I complete the windows thread local storage bindings and ARM context switching. My immediate next priorities will be to fix #2064 and clean up the uv bindings, get everything building on all platforms.
Diffstat (limited to 'src/libcore/rt/stack.rs')
| -rw-r--r-- | src/libcore/rt/stack.rs | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/libcore/rt/stack.rs b/src/libcore/rt/stack.rs new file mode 100644 index 00000000000..02c47218ed8 --- /dev/null +++ b/src/libcore/rt/stack.rs @@ -0,0 +1,49 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use vec; + +pub struct StackSegment { + buf: ~[u8] +} + +pub impl StackSegment { + static fn new(size: uint) -> StackSegment { + // Crate a block of uninitialized values + let mut stack = vec::with_capacity(size); + unsafe { + vec::raw::set_len(&mut stack, size); + } + + StackSegment { + buf: stack + } + } + + fn end(&self) -> *uint { + unsafe { + vec::raw::to_ptr(self.buf).offset(self.buf.len()) as *uint + } + } +} + +pub struct StackPool(()); + +impl StackPool { + + static fn new() -> StackPool { StackPool(()) } + + fn take_segment(&self, min_size: uint) -> StackSegment { + StackSegment::new(min_size) + } + + fn give_segment(&self, _stack: StackSegment) { + } +} |
