about summary refs log tree commit diff
path: root/src/libstd/rt
AgeCommit message (Collapse)AuthorLines
2013-11-28Register new snapshotsAlex Crichton-10/+9
2013-11-27Use the native tls implementation on androidAlex Crichton-248/+227
Turns out android doesn't support LLVM's thread_local attribute and accompanying implementation. Closes #10686
2013-11-27Improve the rt::thread moduleAlex Crichton-61/+153
* Added doc comments explaining what all public functionality does. * Added the ability to spawn a detached thread * Added the ability for the procs to return a value in 'join'
2013-11-26Clean up statically initialized data on shutdownAlex Crichton-14/+55
Whenever the runtime is shut down, add a few hooks to clean up some of the statically initialized data of the runtime. Note that this is an unsafe operation because there's no guarantee on behalf of the runtime that there's no other code running which is using the runtime. This helps turn down the noise a bit in the valgrind output related to statically initialized mutexes. It doesn't turn the noise down to 0 because there are still statically initialized mutexes in dynamic_lib and os::with_env_lock, but I believe that it would be easy enough to add exceptions for those cases and I don't think that it's the runtime's job to go and clean up that data.
2013-11-26auto merge of #10312 : thestinger/rust/thread_local, r=alexcritchtonbors-5/+105
This provides a building block for fast thread-local storage. It does not change the safety semantics of `static mut`. Closes #10310
2013-11-26port the runtime to `#[thread_local]`Daniel Micay-5/+105
2013-11-26librustc: Fix merge fallout.Patrick Walton-5/+5
2013-11-26libstd: Fix Win32 and other bustage.Patrick Walton-5/+5
2013-11-26librustc: Make `||` lambdas not infer to `proc`sPatrick Walton-26/+34
2013-11-26test: Remove non-procedure uses of `do` from compiletest, libstd tests,Patrick Walton-40/+40
compile-fail tests, run-fail tests, and run-pass tests.
2013-11-26libstd: Remove all non-`proc` uses of `do` from libstdPatrick Walton-154/+131
2013-11-26Removed unneccessary `_iter` suffixes from various APIsMarvin Löbel-4/+4
2013-11-25auto merge of #10631 : klutzy/rust/win-fixes, r=alexcrichtonbors-4/+9
This patchset fixes some parts broken on Win64. This also adds `--disable-pthreads` flags to llvm on mingw-w64 archs (both 32-bit and 64-bit, not mingw) due to bad performance. See #8996 for discussion.
2013-11-25auto merge of #10643 : jorendorff/rust/master, r=alexcrichtonbors-1/+1
2013-11-24auto merge of #10603 : alexcrichton/rust/no-linked-failure, r=brsonbors-752/+36
The reasons for doing this are: * The model on which linked failure is based is inherently complex * The implementation is also very complex, and there are few remaining who fully understand the implementation * There are existing race conditions in the core context switching function of the scheduler, and possibly others. * It's unclear whether this model of linked failure maps well to a 1:1 threading model Linked failure is often a desired aspect of tasks, but we would like to take a much more conservative approach in re-implementing linked failure if at all. Closes #8674 Closes #8318 Closes #8863
2013-11-24Remove linked failure from the runtimeAlex Crichton-752/+36
The reasons for doing this are: * The model on which linked failure is based is inherently complex * The implementation is also very complex, and there are few remaining who fully understand the implementation * There are existing race conditions in the core context switching function of the scheduler, and possibly others. * It's unclear whether this model of linked failure maps well to a 1:1 threading model Linked failure is often a desired aspect of tasks, but we would like to take a much more conservative approach in re-implementing linked failure if at all. Closes #8674 Closes #8318 Closes #8863
2013-11-24Fix spelling of "vacuum" in one of the abort quotes.Jason Orendorff-1/+1
2013-11-24std::rt: Fix crate_map on Win64klutzy-1/+6
2013-11-24std::rt: Fix record_stack_bounds on win64klutzy-2/+2
2013-11-24std: Fix transmute error on win64klutzy-1/+1
2013-11-23Move mutable::Mut to cell::RefCellSteven Fackler-8/+7
2013-11-22Change Mut::map to Mut::withSteven Fackler-3/+3
2013-11-22Cell -> Mut switch in commSteven Fackler-20/+24
2013-11-22The original fixme #2699 was removed back in PR #6053.Felix S. Klock II-1/+0
I cannot tell whether the original comment was unsure about the arithmetic calculations, or if it was unsure about the assumptions being made about the alignment of the current allocation pointer. The arithmetic calculation looks fine to me, though. This technique is documented e.g. in Henry Warren's "Hacker's Delight" (section 3-1). (I am sure one can find it elsewhere too, its not an obscure property.)
2013-11-19libstd: Change all uses of `&fn(A)->B` over to `|A|->B` in libstdPatrick Walton-30/+30
2013-11-19auto merge of #10558 : alexcrichton/rust/faster-stdout, r=pcwalton,pcwaltonbors-0/+1
There are issues with reading stdin when it is actually attached to a pipe, but I have run into no problems in writing to stdout/stderr when they are attached to pipes.
2013-11-18auto merge of #10561 : pcwalton/rust/procify, r=alexcrichtonbors-46/+64
r? @alexcrichton
2013-11-18Move runtime files to C instead of C++Alex Crichton-0/+1
Explicitly have the only C++ portion of the runtime be one file with exception handling. All other runtime files must now live in C and be fully defined in C.
2013-11-18Remove the C++ lock_and_signal typeAlex Crichton-33/+52
A the same time this purges all runtime support needed for statically initialized mutexes, moving all users over to the new Mutex type instead.
2013-11-18libstd: Change all `~fn()`s to `proc`s in the standard library.Patrick Walton-46/+64
This makes `Cell`s no longer necessary in most cases.
2013-11-18Allow piped stdout/stderr use uv_tty_tAlex Crichton-0/+1
There are issues with reading stdin when it is actually attached to a pipe, but I have run into no problems in writing to stdout/stderr when they are attached to pipes.
2013-11-18rt: Namespace all C functions under rust_Brian Anderson-8/+8
2013-11-13Implement native::IoFactoryAlex Crichton-31/+29
This commit re-organizes the io::native module slightly in order to have a working implementation of rtio::IoFactory which uses native implementations. The goal is to seamlessly multiplex among libuv/native implementations wherever necessary. Right now most of the native I/O is unimplemented, but we have existing bindings for file descriptors and processes which have been hooked up. What this means is that you can now invoke println!() from libstd with no local task, no local scheduler, and even without libuv. There's still plenty of work to do on the native I/O factory, but this is the first steps into making it an official portion of the standard library. I don't expect anyone to reach into io::native directly, but rather only std::io primitives will be used. Each std::io interface seamlessly falls back onto the native I/O implementation if the local scheduler doesn't have a libuv one (hurray trait ojects!)
2013-11-11Move std::rt::io to std::ioAlex Crichton-8654/+24
2013-11-11auto merge of #10424 : alexcrichton/rust/optimize-buffered, r=brsonbors-2/+13
I was benchmarking rust-http recently, and I saw that 50% of its time was spent creating buffered readers/writers. Albeit rust-http wasn't using std::rt::io::buffered, but the same idea applies here. It's much cheaper to malloc a large region and not initialize it than to set it all to 0. Buffered readers/writers never use uninitialized data, and their internal buffers are encapsulated, so any usage of uninitialized slots are an implementation bug in the readers/writers.
2013-11-12Implemented a ProcessExit enum and helper methods to std::rt::io::process ↵Matthew Iselin-3/+39
for getting process termination status, or the signal that terminated a process. A test has been added to rtio-processes.rs to ensure signal termination is picked up correctly.
2013-11-11Decrease the default stack size back to 2MBAlex Crichton-1/+1
I increased this to 4MB when I implemented abort-on-stack-overflow for Rust functions. Now that the fixed_stack_segment attribute is removed, no rust function will ever reasonably request 2MB of stack (due to calling an FFI function). The default size of 2MB should be plenty for everyday use-cases, and tasks can still request more stack via the spawning API.
2013-11-11Remove #[fixed_stack_segment] and #[rust_stack]Alex Crichton-113/+8
These two attributes are no longer useful now that Rust has decided to leave segmented stacks behind. It is assumed that the rust task's stack is always large enough to make an FFI call (due to the stack being very large). There's always the case of stack overflow, however, to consider. This does not change the behavior of stack overflow in Rust. This is still normally triggered by the __morestack function and aborts the whole process. C stack overflow will continue to corrupt the stack, however (as it did before this commit as well). The future improvement of a guard page at the end of every rust stack is still unimplemented and is intended to be the mechanism through which we attempt to detect C stack overflow. Closes #8822 Closes #10155
2013-11-11Optimize creation of buffered readers/writersAlex Crichton-2/+13
I was benchmarking rust-http recently, and I saw that 50% of its time was spent creating buffered readers/writers. Albeit rust-http wasn't using std::rt::io::buffered, but the same idea applies here. It's much cheaper to malloc a large region and not initialize it than to set it all to 0. Buffered readers/writers never use uninitialized data, and their internal buffers are encapsulated, so any usage of uninitialized slots are an implementation bug in the readers/writers.
2013-11-11auto merge of #10409 : alexcrichton/rust/issue-10386, r=brsonbors-1/+5
Turns out the pipe names must have special names on windows. Once we have special names, all the tests pass just fine. Closes #10386
2013-11-11auto merge of #10394 : yichoi/rust/make_check_pass_android, r=brsonbors-3/+4
To enable test on android bot #9120 some tests are disabled and can be fixed further.
2013-11-11Clean lint on test buildCorey Richardson-2/+0
2013-11-10Enable uv pipe tests on windowsAlex Crichton-1/+5
Turns out the pipe names must have special names on windows. Once we have special names, all the tests pass just fine. Closes #10386
2013-11-10Register new snapshotsAlex Crichton-23/+4
2013-11-10Fix usage of libuv for windowsAlex Crichton-7/+13
2013-11-10Another round of test fixes from previous commitsAlex Crichton-24/+23
2013-11-10Fall back from uv tty instances more aggressivelyAlex Crichton-5/+2
It appears that uv's support for interacting with a stdio stream as a tty when it's actually a pipe is pretty problematic. To get around this, promote a check to see if the stream is a tty to the top of the tty constructor, and bail out quickly if it's not identified as a tty. Closes #10237
2013-11-10Assorted test fixes and merge conflictsAlex Crichton-4/+5
2013-11-10Rework the idle callback to have a safer interfaceAlex Crichton-21/+11
It turns out that the uv implementation would cause use-after-free if the idle callback was used after the call to `close`, and additionally nothing would ever really work that well if `start()` were called twice. To change this, the `start` and `close` methods were removed in favor of specifying the callback at creation, and allowing destruction to take care of closing the watcher.
2013-11-10Add bindings to uv's utime functionAlex Crichton-4/+47
This exposes the ability to change the modification and access times on a file. Closes #10266