about summary refs log tree commit diff
path: root/src/libstd/rt
AgeCommit message (Collapse)AuthorLines
2013-12-31std: print RUST_LOG=::help in sorted order.Huon Wilson-2/+9
Fixes #8949.
2013-12-30Add rust_fail. #11219Brian Anderson-14/+21
2013-12-27std: uniform modules titles for docLuca Bruno-1/+1
This commit uniforms the short title of modules provided by libstd, in order to make their roles more explicit when glancing at the index. Signed-off-by: Luca Bruno <lucab@debian.org>
2013-12-25Test fixes and rebase conflictsAlex Crichton-105/+137
* 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-24rustuv: Remove the id() function from IoFactoryAlex Crichton-2/+0
The only user of this was the homing code in librustuv, and it just manually does the cast from a pointer to a uint now.
2013-12-24green: Properly wait for main before shutdownAlex Crichton-12/+15
There was a race in the code previously where schedulers would *immediately* shut down after spawning the main task (because the global task count would still be 0). This fixes the logic by blocking the sched pool task in receving on a port instead of spawning a task into the pool to receive on a port. The modifications necessary were to have a "simple task" running by the time the code is executing, but this is a simple enough thing to implement and I forsee this being necessary to have implemented in the future anyway.
2013-12-24Test fixes and rebase problemsAlex Crichton-2/+16
Note that this removes a number of run-pass tests which are exercising behavior of the old runtime. This functionality no longer exists and is thoroughly tested inside of libgreen and libnative. There isn't really the notion of "starting the runtime" any more. The major notion now is "bootstrapping the initial task".
2013-12-24green: Allow specifying an IoFactory for poolsAlex Crichton-1/+1
This allows creation of different sched pools with different io factories. Namely, this will be used to test the basic I/O loop in the green crate. This can also be used to override the global default.
2013-12-24Finalize the green::Pool typeAlex Crichton-1/+19
The scheduler pool now has a much more simplified interface. There is now a clear distinction between creating the pool and then interacting the pool. When a pool is created, all schedulers are not active, and only later if a spawn is done does activity occur. There are four operations that you can do on a pool: 1. Create a new pool. The only argument to this function is the configuration for the scheduler pool. Currently the only configuration parameter is the number of threads to initially spawn. 2. Spawn a task into this pool. This takes a procedure and task configuration options and spawns a new task into the pool of schedulers. 3. Spawn a new scheduler into the pool. This will return a handle on which to communicate with the scheduler in order to do something like a pinned task. 4. Shut down the scheduler pool. This will consume the scheduler pool, request all of the schedulers to shut down, and then wait on all the scheduler threads. Currently this will block the invoking OS thread, but I plan on making 'Thread::join' not a thread-blocking call. These operations can be used to encode all current usage of M:N schedulers, as well as providing a simple interface through which a pool can be modified. There is currently no way to remove a scheduler from a pool of scheduler, as there's no way to guarantee that a scheduler has exited. This may be added in the future, however (as necessary).
2013-12-24std: Get stdtest all passing againAlex Crichton-63/+50
This commit brings the library up-to-date in order to get all tests passing again
2013-12-24std: Update std::rt::thread to specify stack sizesAlex Crichton-8/+16
It's now possible to spawn an OS thread with a stack that has a specific size.
2013-12-24std: Fix a bug where Local::take() didn't zero outAlex Crichton-1/+3
In the compiled version of local_ptr (that with #[thread_local]), the take() funciton didn't zero-out the previous pointer, allowing for multiple takes (with fewer runtime assertions being tripped).
2013-12-24green: Rip the bandaid off, introduce libgreenAlex Crichton-3442/+327
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-12-24std: Expose that LocalIo may not always be availableAlex Crichton-23/+37
It is not the case that all programs will always be able to acquire an instance of the LocalIo borrow, so this commit exposes this limitation by returning Option<LocalIo> from LocalIo::borrow(). At the same time, a helper method LocalIo::maybe_raise() has been added in order to encapsulate the functionality of raising on io_error if there is on local I/O available.
2013-12-24std: Introduce std::syncAlex Crichton-1378/+0
For now, this moves the following modules to std::sync * UnsafeArc (also removed unwrap method) * mpsc_queue * spsc_queue * atomics * mpmc_bounded_queue * deque We may want to remove some of the queues, but for now this moves things out of std::rt into std::sync
2013-12-24std: Delete rt::testAlex Crichton-440/+0
This module contains many M:N specific concepts. This will no longer be available with libgreen, and most functions aren't really that necessary today anyway. New testing primitives will be introduced as they become available for 1:1 and M:N. A new io::test module is introduced with the new ip4/ip6 address helpers to continue usage in io tests.
2013-12-24std: Introduce an unstable::stack moduleAlex Crichton-2/+2
This module will be used to manage the OS-specific TLS registers used to specify the bounds of the current rust stack (useful in 1:1 and M:N)
2013-12-24std: Introduce a Runtime traitAlex Crichton-269/+25
This trait is used to abstract the differences between 1:1 and M:N scheduling and is the sole dispatch point for the differences between these two scheduling modes. This, and the following series of commits, is not intended to compile. Only after the entire transition is complete are programs expected to compile.
2013-12-24Stop using C++ exceptions for stack unwinding.Vadim Chugunov-66/+261
2013-12-20std: silence warnings when compiling test.Huon Wilson-6/+14
2013-12-18auto merge of #11029 : huonw/rust/rm-vec-as-buf, r=cmrbors-7/+5
For `str.as_mut_buf`, un-closure-ification is achieved by outright removal (see commit message). The others are replaced by `.as_ptr`, `.as_mut_ptr` and `.len`
2013-12-19std::vec: remove .as_muf_buf, replaced by .as_mut_ptr & .len.Huon Wilson-7/+5
2013-12-17Don't allow impls to force public typesAlex Crichton-1/+1
This code in resolve accidentally forced all types with an impl to become public. This fixes it by default inheriting the privacy of what was previously there and then becoming `true` if nothing else exits. Closes #10545
2013-12-16Test fallout from std::comm rewriteAlex Crichton-5/+9
2013-12-16Fallout of rewriting std::commAlex Crichton-1446/+220
2013-12-16Rewrite std::commAlex Crichton-122/+423
* Streams are now ~3x faster than before (fewer allocations and more optimized) * Based on a single-producer single-consumer lock-free queue that doesn't always have to allocate on every send. * Blocking via mutexes/cond vars outside the runtime * Streams work in/out of the runtime seamlessly * Select now works in/out of the runtime seamlessly * Streams will now fail!() on send() if the other end has hung up * try_send() will not fail * PortOne/ChanOne removed * SharedPort removed * MegaPipe removed * Generic select removed (only one kind of port now) * API redesign * try_recv == never block * recv_opt == block, don't fail * iter() == Iterator<T> for Port<T> * removed peek * Type::new * Removed rt::comm
2013-12-15librustc: Remove identifiers named `box`, since it's about to become a keyword.Patrick Walton-32/+37
2013-12-15auto merge of #10984 : huonw/rust/clean-raw, r=cmrbors-3/+3
See commits for details.
2013-12-15std::vec: convert to(_mut)_ptr to as_... methods on &[] and &mut [].Huon Wilson-2/+2
2013-12-15Move std::{str,vec}::raw::set_len to an unsafe method on Owned{Vector,Str}.Huon Wilson-1/+1
2013-12-15std::rt: s/pausible/pausable/.Huon Wilson-18/+18
2013-12-15std: fix spelling in docs.Huon Wilson-1/+1
2013-12-11Make 'self lifetime illegal.Erik Price-9/+9
Also remove all instances of 'self within the codebase. This fixes #10889.
2013-12-10auto merge of #10791 : pcwalton/rust/decelling, r=pcwaltonbors-307/+311
34 uses of `Cell` remain. r? @alexcrichton
2013-12-10libstd: Remove `Cell` from the library.Patrick Walton-13/+18
2013-12-10Make crate hash stable and externally computable.Jack Moffitt-2/+0
This replaces the link meta attributes with a pkgid attribute and uses a hash of this as the crate hash. This makes the crate hash computable by things other than the Rust compiler. It also switches the hash function ot SHA1 since that is much more likely to be available in shell, Python, etc than SipHash. Fixes #10188, #8523.
2013-12-10libstd: Remove two uses of `Cell`.Patrick Walton-6/+4
2013-12-10libstd: Change `atomically` to use RAII.Patrick Walton-11/+7
2013-12-10librustuv: Change `with_local_io` to use RAII.Patrick Walton-25/+53
2013-12-10libstd: Remove some cells involved inPatrick Walton-10/+6
`deschedule_running_task_and_then`.
2013-12-10librustuv: RAII-ify `Local::borrow`, and remove some 12 Cells.Patrick Walton-146/+168
2013-12-10libextra: Another round of de-`Cell`-ing.Patrick Walton-110/+69
34 uses of `Cell` remain.
2013-12-08Remove dead codesKiet Tran-22/+6
2013-12-06auto merge of #10364 : Kimundi/rust/result_compose, r=alexcrichtonbors-0/+1
This implements parts of the changes to `Result` and `Option` I proposed and discussed in this thread: https://mail.mozilla.org/pipermail/rust-dev/2013-November/006254.html This PR includes: - Adding `ok()` and `err()` option adapters for both `Result` variants. - Removing `get_ref`, `expect` and iterator constructors for `Result`, as they are reachable with the variant adapters. - Removing `Result`s `ToStr` bound on the error type because of composability issues. (See https://mail.mozilla.org/pipermail/rust-dev/2013-November/006283.html) - Some warning cleanups
2013-12-06Link rustllvm statically, and distribute a static snapshotAlex Crichton-0/+1
In order to keep up to date with changes to the libraries that `llvm-config` spits out, the dependencies to the LLVM are a dynamically generated rust file. This file is now automatically updated whenever LLVM is updated to get kept up-to-date. At the same time, this cleans out some old cruft which isn't necessary in the makefiles in terms of dependencies. Closes #10745 Closes #10744
2013-12-06Made Results API more composableMarvin Löbel-0/+1
2013-12-05auto merge of #10817 : alexcrichton/rust/sched-fix, r=brsonbors-4/+49
Right now, as pointed out in #8132, it is very easy to introduce a subtle race in the runtime. I believe that this is the cause of the current flakiness on the bots. I have taken the last idea mentioned in that issue which is to use a lock around descheduling and context switching in order to solve this race. Closes #8132
2013-12-05Solve some nasty deschedulinging races with a lockAlex Crichton-4/+49
Right now, as pointed out in #8132, it is very easy to introduce a subtle race in the runtime. I believe that this is the cause of the current flakiness on the bots. I have taken the last idea mentioned in that issue which is to use a lock around descheduling and context switching in order to solve this race. Closes #8132
2013-12-04Rename std::rt::deque::*::init() to *::new()Kevin Ballard-20/+20