about summary refs log tree commit diff
path: root/src/libstd/task.rs
AgeCommit message (Collapse)AuthorLines
2014-05-27std: Rename strbuf operations to stringRicho Healey-2/+2
[breaking-change]
2014-05-27std: Remove String's to_ownedRicho Healey-2/+2
2014-05-24core: rename strbuf::StrBuf to string::StringRicho Healey-2/+2
[breaking-change]
2014-05-22libstd: Remove `~str` from all `libstd` modules except `fmt` and `str`.Patrick Walton-3/+4
2014-05-15core: Update all tests for fmt movementAlex Crichton-1/+0
2014-05-13std: Move the owned module from core to stdAlex Crichton-2/+3
The compiler was updated to recognize that implementations for ty_uniq(..) are allowed if the Box lang item is located in the current crate. This enforces the idea that libcore cannot allocated, and moves all related trait implementations from libcore to libstd. This is a breaking change in that the AnyOwnExt trait has moved from the any module to the owned module. Any previous users of std::any::AnyOwnExt should now use std::owned::AnyOwnExt instead. This was done because the trait is intended for Box traits and only Box traits. [breaking-change]
2014-05-07core: Add unwrap()/unwrap_err() methods to ResultAlex Crichton-0/+1
These implementations must live in libstd right now because the fmt module has not been migrated yet. This will occur in a later PR. Just to be clear, there are new extension traits, but they are not necessary once the std::fmt module has migrated to libcore, which is a planned migration in the future.
2014-05-07core: Inherit possible string functionalityAlex Crichton-1/+1
This moves as much allocation as possible from teh std::str module into core::str. This includes essentially all non-allocating functionality, mostly iterators and slicing and such. This primarily splits the Str trait into only having the as_slice() method, adding a new StrAllocating trait to std::str which contains the relevant new allocation methods. This is a breaking change if any of the methods of "trait Str" were overriden. The old functionality can be restored by implementing both the Str and StrAllocating traits. [breaking-change]
2014-05-06librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, exceptPatrick Walton-9/+11
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box<Type>`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change]
2014-05-02Replace most ~exprs with 'box'. #11779Brian Anderson-2/+2
2014-04-23Move task::task() to TaskBuilder::new()Steven Fackler-34/+27
The constructor for `TaskBuilder` is being changed to an associated function called `new` for consistency with the rest of the standard library. Closes #13666 [breaking-change]
2014-04-18Replace all ~"" with "".to_owned()Richo Healey-4/+5
2014-04-15std: Impl Deref/DerefMut for a borrowed taskAlex Crichton-6/+3
2014-04-08Register new snapshotsAlex Crichton-9/+9
2014-03-31std: Switch field privacy as necessaryAlex Crichton-8/+8
2014-03-28Rename Pod into CopyFlavio Percoco-2/+2
Summary: So far, we've used the term POD "Plain Old Data" to refer to types that can be safely copied. However, this term is not consistent with the other built-in bounds that use verbs instead. This patch renames the Pod kind into Copy. RFC: 0003-opt-in-builtin-traits Test Plan: make check Reviewers: cmr Differential Revision: http://phabricator.octayn.net/D3
2014-03-27Fix fallout of removing default boundsAlex Crichton-28/+20
This is all purely fallout of getting the previous commit to compile.
2014-03-15log: Introduce liblog, the old std::loggingAlex Crichton-4/+0
This commit moves all logging out of the standard library into an external crate. This crate is the new crate which is responsible for all logging macros and logging implementation. A few reasons for this change are: * The crate map has always been a bit of a code smell among rust programs. It has difficulty being loaded on almost all platforms, and it's used almost exclusively for logging and only logging. Removing the crate map is one of the end goals of this movement. * The compiler has a fair bit of special support for logging. It has the __log_level() expression as well as generating a global word per module specifying the log level. This is unfairly favoring the built-in logging system, and is much better done purely in libraries instead of the compiler itself. * Initialization of logging is much easier to do if there is no reliance on a magical crate map being available to set module log levels. * If the logging library can be written outside of the standard library, there's no reason that it shouldn't be. It's likely that we're not going to build the highest quality logging library of all time, so third-party libraries should be able to provide just as high-quality logging systems as the default one provided in the rust distribution. With a migration such as this, the change does not come for free. There are some subtle changes in the behavior of liblog vs the previous logging macros: * The core change of this migration is that there is no longer a physical log-level per module. This concept is still emulated (it is quite useful), but there is now only a global log level, not a local one. This global log level is a reflection of the maximum of all log levels specified. The previously generated logging code looked like: if specified_level <= __module_log_level() { println!(...) } The newly generated code looks like: if specified_level <= ::log::LOG_LEVEL { if ::log::module_enabled(module_path!()) { println!(...) } } Notably, the first layer of checking is still intended to be "super fast" in that it's just a load of a global word and a compare. The second layer of checking is executed to determine if the current module does indeed have logging turned on. This means that if any module has a debug log level turned on, all modules with debug log levels get a little bit slower (they all do more expensive dynamic checks to determine if they're turned on or not). Semantically, this migration brings no change in this respect, but runtime-wise, this will have a perf impact on some code. * A `RUST_LOG=::help` directive will no longer print out a list of all modules that can be logged. This is because the crate map will no longer specify the log levels of all modules, so the list of modules is not known. Additionally, warnings can no longer be provided if a malformed logging directive was supplied. The new "hello world" for logging looks like: #[phase(syntax, link)] extern crate log; fn main() { debug!("Hello, world!"); }
2014-03-13std: Rename Chan/Port types and constructorAlex Crichton-43/+40
* Chan<T> => Sender<T> * Port<T> => Receiver<T> * Chan::new() => channel() * constructor returns (Sender, Receiver) instead of (Receiver, Sender) * local variables named `port` renamed to `rx` * local variables named `chan` renamed to `tx` Closes #11765
2014-03-12rustc: Remove matching on ~str from the languageMichael Darakananda-2/+2
The `~str` type is not long for this world as it will be superseded by the soon-to-come DST changes for the language. The new type will be `~Str`, and matching over the allocation will no longer be supported. Matching on `&str` will continue to work, in both a pre and post DST world.
2014-02-16Clean up std::task docs, make TaskBuilder a real builderKevin Ballard-95/+26
Delete all the documentation from std::task that references linked failure. Tweak TaskBuilder to be more builder-like. .name() is now .named() and .add_wrapper() is now .with_wrapper(). Remove .watched() and .unwatched() as they didn't actually do anything.
2014-02-15auto merge of #12302 : alexcrichton/rust/issue-12295, r=brsonbors-1/+0
The previous code erroneously assumed that 'steals > cnt' was always true, but that was a false assumption. The code was altered to decrement steals to a minimum of 0 instead of taking all of cnt into account. I didn't include the exact test from #12295 because it could run for quite awhile, and instead set the threshold for MAX_STEALS to much lower during testing. I found that this triggered the old bug quite frequently when running without this fix. Closes #12295
2014-02-15auto merge of #12298 : alexcrichton/rust/rustdoc-testing, r=sfacklerbors-1/+1
It's too easy to forget the `rust` tag to test something. Closes #11698
2014-02-15Silence some unused import warningsAlex Crichton-1/+0
2014-02-15std: clean up ptr a bitCorey Richardson-2/+2
2014-02-14Fix all code examplesAlex Crichton-1/+1
2014-02-11Rewrite channels yet again for upgradeabilityAlex Crichton-3/+2
This, the Nth rewrite of channels, is not a rewrite of the core logic behind channels, but rather their API usage. In the past, we had the distinction between oneshot, stream, and shared channels, but the most recent rewrite dropped oneshots in favor of streams and shared channels. This distinction of stream vs shared has shown that it's not quite what we'd like either, and this moves the `std::comm` module in the direction of "one channel to rule them all". There now remains only one Chan and one Port. This new channel is actually a hybrid oneshot/stream/shared channel under the hood in order to optimize for the use cases in question. Additionally, this also reduces the cognitive burden of having to choose between a Chan or a SharedChan in an API. My simple benchmarks show no reduction in efficiency over the existing channels today, and a 3x improvement in the oneshot case. I sadly don't have a pre-last-rewrite compiler to test out the old old oneshots, but I would imagine that the performance is comparable, but slightly slower (due to atomic reference counting). This commit also brings the bonus bugfix to channels that the pending queue of messages are all dropped when a Port disappears rather then when both the Port and the Chan disappear.
2014-02-07Delete send_str, rewrite clients on top of MaybeOwned<'static>Kevin Ballard-5/+4
Declare a `type SendStr = MaybeOwned<'static>` to ease readibility of types that needed the old SendStr behavior. Implement all the traits for MaybeOwned that SendStr used to implement.
2014-02-04Replace NonCopyable usage with NoPodFlavio Percoco-4/+3
cc #10834
2014-02-03std: Fix tests with io_error usageAlex Crichton-1/+1
2014-01-29Removing do keyword from libstd and librustcScott Lawrence-44/+44
2014-01-21Remove unnecessary parentheses.Huon Wilson-1/+1
2014-01-06Support arbitrary stdout/stderr/logger handlesAlex Crichton-35/+13
This will allow capturing of common things like logging messages, stdout prints (using stdio println), and failure messages (printed to stderr). Any new prints added to libstd should be funneled through these task handles to allow capture as well. Additionally, this commit redirects logging back through a `Logger` trait so the log level can be usefully consumed by an arbitrary logger. This commit also introduces methods to set the task-local stdout handles: * std::io::stdio::set_stdout * std::io::stdio::set_stderr * std::io::logging::set_logger These methods all return the previous logger just in case it needs to be used for inspection. I plan on using this infrastructure for extra::test soon, but we don't quite have the primitives that I'd like to use for it, so it doesn't migrate extra::test at this time. Closes #6369
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-24green: Move a scheduler test inside libgreenAlex Crichton-60/+0
This test also had a race condition in using the cvar/lock, so I fixed that up as well. The race originated from one half trying to destroy the lock when another half was using it.
2013-12-24Finalize the green::Pool typeAlex Crichton-15/+16
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-66/+32
This commit brings the library up-to-date in order to get all tests passing again
2013-12-24green: Rip the bandaid off, introduce libgreenAlex Crichton-0/+745
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.
2011-12-14Remove some duplicated unused parts of std now that they're present in core.Graydon Hoare-357/+0
2011-12-13Copy first batch of material from libstd to libcore.Graydon Hoare-2/+9
2011-12-07Disallow binding by-mut-ref and by-move argumentsMarijn Haverbeke-1/+1
Fix bug in bound by-copy arguments. Closes #1261
2011-12-06Establish 'core' library separate from 'std'.Graydon Hoare-0/+350