about summary refs log tree commit diff
path: root/src/libstd/rt/util.rs
AgeCommit message (Collapse)AuthorLines
2014-02-03std: Remove io::io_errorAlex Crichton-2/+5
* All I/O now returns IoResult<T> = Result<T, IoError> * All formatting traits now return fmt::Result = IoResult<()> * The if_ok!() macro was added to libstd
2014-01-26Removed all instances of XXX in preparation for relaxing of FIXME ruleSalem Talha-1/+1
2014-01-22Replace C types with Rust types in libstd, closes #7313Florian Hahn-1/+0
2014-01-15libstd: Added more #[inline] annotations and replaced uses of `libc::abort` ↵Eduard Burtescu-1/+2
with the intrinsic.
2014-01-07std: Fill in all missing importsAlex Crichton-0/+2
Fallout from the previous commits
2013-12-25Test fixes and rebase conflictsAlex Crichton-2/+1
* vec::raw::to_ptr is gone * Pausible => Pausable * Removing @ * Calling the main task "<main>" * Removing unused imports * Removing unused mut * Bringing some libextra tests up to date * Allowing compiletest to work at stage0 * Fixing the bootstrap-from-c rmake tests * assert => rtassert in a few cases * printing to stderr instead of stdout in fail!()
2013-12-24green: Rip the bandaid off, introduce libgreenAlex Crichton-11/+0
This extracts everything related to green scheduling from libstd and introduces a new libgreen crate. This mostly involves deleting most of std::rt and moving it to libgreen. Along with the movement of code, this commit rearchitects many functions in the scheduler in order to adapt to the fact that Local::take now *only* works on a Task, not a scheduler. This mostly just involved threading the current green task through in a few locations, but there were one or two spots where things got hairy. There are a few repercussions of this commit: * tube/rc have been removed (the runtime implementation of rc) * There is no longer a "single threaded" spawning mode for tasks. This is now encompassed by 1:1 scheduling + communication. Convenience methods have been introduced that are specific to libgreen to assist in the spawning of pools of schedulers.
2013-12-24std: Handle prints with literally no contextAlex Crichton-3/+14
Printing is an incredibly useful debugging utility, and it's not much help if your debugging prints just trigger an obscure abort when you need them most. In order to handle this case, forcibly fall back to a libc::write implementation of printing whenever a local task is not available. Note that this is *not* a 1:1 fallback. All 1:1 rust tasks will still have a local Task that it can go through (and stdio will be created through the local IO factory), this is only a fallback for "no context" rust code (such as that setting up the context).
2013-11-26Removed unneccessary `_iter` suffixes from various APIsMarvin Löbel-1/+1
2013-11-24Fix spelling of "vacuum" in one of the abort quotes.Jason Orendorff-1/+1
2013-11-13Implement native::IoFactoryAlex Crichton-19/+5
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-2/+2
2013-11-11Remove #[fixed_stack_segment] and #[rust_stack]Alex Crichton-3/+0
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-10-24Test fixes and merge conflictsAlex Crichton-7/+13
2013-10-24Stop logging task failure to task loggersAlex Crichton-1/+1
The isn't an ideal patch, and the comment why is in the code. Basically uvio uses task::unkillable which touches the kill flag for a task, and if the task is failing due to mismangement of the kill flag, then there will be serious problems when the task tries to print that it's failing.
2013-10-24Move as much I/O as possible off of native::ioAlex Crichton-2/+11
When uv's TTY I/O is used for the stdio streams, the file descriptors are put into a non-blocking mode. This means that other concurrent writes to the same stream can fail with EAGAIN or EWOULDBLOCK. By all I/O to event-loop I/O, we avoid this error. There is one location which cannot move, which is the runtime's dumb_println function. This was implemented to handle the EAGAIN and EWOULDBLOCK errors and simply retry again and again.
2013-10-11De-pub some private runtime componentsAlex Crichton-16/+10
This change was waiting for privacy to get sorted out, which should be true now that #8215 has landed. Closes #4427
2013-10-10Migrate users of io::fd_t to io::native::file::fd_tAlex Crichton-4/+6
2013-09-30std: Remove usage of fmt!Alex Crichton-5/+5
2013-08-29rt: Handle non-integer RUST_THREADS (slightly) more gracefully.Huon Wilson-2/+8
Previously it would call Option.unwrap(), which calls `fail!` on None, which doesn't work without the runtime (e.g. when initialising it).
2013-08-24std::rt: Enforce sanity a while longerBrian Anderson-1/+2
I'm not comfortable turning off rtassert! yet
2013-08-23Define cfg(rtopt) when optimizing. Turn off runtime sanity checksBrian Anderson-0/+3
Naturally, and sadly, turning off sanity checks in the runtime is a noticable performance win. The particular test I'm running goes from ~1.5 s to ~1.3s. Sanity checks are turned *on* when not optimizing, or when cfg includes `rtdebug` or `rtassert`.
2013-08-23rt: Remove exit_status helpersBrian Anderson-16/+5
2013-08-20auto merge of #8566 : toddaaro/rust/idle-opt+cleaning, r=catamorphism,brsonbors-2/+1
Instead of a furious storm of idle callbacks we just have one. This is a major performance gain - around 40% on my machine for the ping pong bench. Also in this PR is a cleanup commit for the scheduler code. Was previously up as a separate PR, but bors load + imminent merge hell led me to roll them together. Was #8549.
2013-08-19Try to fix mac valgrind bot by disabling thread-heavy activities.Graydon Hoare-1/+27
2013-08-19Add externfn macro and correctly label fixed_stack_segmentsNiko Matsakis-3/+10
2013-08-16A round of code cleaning for the primary scheduler code. Comments have been ↵toddaaro-2/+1
updated, a minor amount of support type restructing has happened, methods have been reordered, and some duplicate code has been purged.
2013-08-10std: merge Iterator and IteratorUtilErick Tryzelaar-1/+0
2013-08-05Updated std::Option, std::Either and std::ResultMarvin Löbel-2/+2
- Made naming schemes consistent between Option, Result and Either - Changed Options Add implementation to work like the maybe monad (return None if any of the inputs is None) - Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead
2013-07-09std: Make os::set_exit_status work with newschedBrian Anderson-0/+22
2013-06-24extra: Make test runner compatible with newschedBrian Anderson-0/+12
2013-06-18std::rt: Improve the rtabort! macroBrian Anderson-2/+63
2013-06-17std::rt: move abort function to util moduleBrian Anderson-0/+4
2013-06-17std::rt: Add util mod and num_cpus functionBrian Anderson-0/+22