about summary refs log tree commit diff
path: root/src/libstd/task
AgeCommit message (Collapse)AuthorLines
2013-10-30Prepared `std::sys` for removal, and made `begin_unwind` simplerMarvin Löbel-20/+35
- `begin_unwind` is now generic over any `T: Any + Send`. - Every value you fail with gets boxed as an `~Any`. - Because of implementation details, `&'static str` and `~str` are still handled specially behind the scenes. - Changed the big macro source string in libsyntax to a raw string literal, and enabled doc comments there.
2013-10-29Move rust's uv implementation to its own crateAlex Crichton-9/+5
There are a few reasons that this is a desirable move to take: 1. Proof of concept that a third party event loop is possible 2. Clear separation of responsibility between rt::io and the uv-backend 3. Enforce in the future that the event loop is "pluggable" and replacable Here's a quick summary of the points of this pull request which make this possible: * Two new lang items were introduced: event_loop, and event_loop_factory. The idea of a "factory" is to define a function which can be called with no arguments and will return the new event loop as a trait object. This factory is emitted to the crate map when building an executable. The factory doesn't have to exist, and when it doesn't then an empty slot is in the crate map and a basic event loop with no I/O support is provided to the runtime. * When building an executable, then the rustuv crate will be linked by default (providing a default implementation of the event loop) via a similar method to injecting a dependency on libstd. This is currently the only location where the rustuv crate is ever linked. * There is a new #[no_uv] attribute (implied by #[no_std]) which denies implicitly linking to rustuv by default Closes #5019
2013-10-28Make some more rt components publicAlex Crichton-5/+9
Primarily this makes the Scheduler and all of its related interfaces public. The reason for doing this is that currently any extern event loops had no access to the scheduler at all. This allows third-party event loops to manipulate the scheduler, along with allowing the uv event loop to live inside of its own crate.
2013-10-28auto merge of #10095 : huonw/rust/master, r=cmrbors-2/+2
Currently each line is a separate bullet point in a list: http://static.rust-lang.org/doc/master/std/task/fn.spawn_sched.html
2013-10-28Allow fail messages to be caught, and introduce the Any traitMarvin Löbel-66/+159
Some code cleanup, sorting of import blocks Removed std::unstable::UnsafeArc's use of Either Added run-fail tests for the new FailWithCause impls Changed future_result and try to return Result<(), ~Any>. - Internally, there is an enum of possible fail messages passend around. - In case of linked failure or a string message, the ~Any gets lazyly allocated in future_results recv method. - For that, future result now returns a wrapper around a Port. - Moved and renamed task::TaskResult into rt::task::UnwindResult and made it an internal enum. - Introduced a replacement typedef `type TaskResult = Result<(), ~Any>`.
2013-10-27Make the documentation for std::task::spawn_sched render correctly.Huon Wilson-2/+2
Currently each line is a separate bullet point in a list: http://static.rust-lang.org/doc/master/std/task/fn.spawn_sched.html
2013-10-24Implement a basic event loop built on LittleLockAlex Crichton-42/+42
It's not guaranteed that there will always be an event loop to run, and this implementation will serve as an incredibly basic one which does not provide any I/O, but allows the scheduler to still run. cc #9128
2013-10-24Migrate Rtio objects to true trait objectsAlex Crichton-2/+2
This moves as many as I could over to ~Trait instead of ~Typedef. The only remaining one is the IoFactoryObject which should be coming soon...
2013-10-23Removed Unnecessary comments and white spaces #4386reedlepee-12/+8
2013-10-23Making fields in std and extra : private #4386reedlepee-15/+19
2013-10-22Drop the '2' suffix from logging macrosAlex Crichton-33/+33
Who doesn't like a massive renaming?
2013-10-18Made `std::task::TaskBuilder::future_result()` easier to useMarvin Löbel-31/+26
2013-10-11De-pub some private runtime componentsAlex Crichton-7/+7
This change was waiting for privacy to get sorted out, which should be true now that #8215 has landed. Closes #4427
2013-10-09option: rewrite the API to use compositionDaniel Micay-8/+8
2013-10-07Fix merge fallout of privacy changesAlex Crichton-1/+1
2013-10-07Fix existing privacy/visibility violationsAlex Crichton-9/+4
This commit fixes all of the fallout of the previous commit which is an attempt to refine privacy. There were a few unfortunate leaks which now must be plugged, and the most horrible one is the current `shouldnt_be_public` module now inside `std::rt`. I think that this either needs a slight reorganization of the runtime, or otherwise it needs to just wait for the external users of these modules to get replaced with their `rt` implementations. Other fixes involve making things pub which should be pub, and otherwise updating error messages that now reference privacy instead of referencing an "unresolved name" (yay!).
2013-10-05Implemented `IntoSendStr` on `SendStr` to allow naming aMarvin Löbel-0/+15
task with a `SendStr` directly
2013-10-05Make a task name use a `SendStr`, allowing for eitherMarvin Löbel-4/+20
static or owned strings
2013-10-01auto merge of #9576 : FlaPer87/rust/issue/9125, r=alexcrichtonbors-19/+29
Fixes #9125
2013-10-01Update std::task::mod docstringFlavio Percoco-19/+29
2013-09-30std: Remove usage of fmt!Alex Crichton-29/+29
2013-09-25std::rt: Implement task yielding. Fix a starvation problemBrian Anderson-4/+1
2013-09-25rustdoc: Change all code-blocks with a scriptAlex Crichton-5/+5
find src -name '*.rs' | xargs sed -i '' 's/~~~.*{\.rust}/```rust/g' find src -name '*.rs' | xargs sed -i '' 's/ ~~~$/ ```/g' find src -name '*.rs' | xargs sed -i '' 's/^~~~$/ ```/g'
2013-09-16switch Drop to `&mut self`Daniel Micay-33/+28
2013-08-27Consolidate local_data implementations, and cleanupAlex Crichton-323/+0
This moves all local_data stuff into the `local_data` module and only that module alone. It also removes a fair amount of "super-unsafe" code in favor of just vanilla code generated by the compiler at the same time. Closes #8113
2013-08-27librustc: Ensure that type parameters are in the right positions in paths.Patrick Walton-12/+12
This removes the stacking of type parameters that occurs when invoking trait methods, and fixes all places in the standard library that were relying on it. It is somewhat awkward in places; I think we'll probably want something like the `Foo::<for T>::new()` syntax.
2013-08-27Trailing spaceFlaper Fesp-1/+1
2013-08-27Rebased and replaced yield with descheduleFlaper Fesp-1/+1
2013-08-27Decrement unkillable counter before failingFlaper Fesp-2/+2
2013-08-27Don't make the runtime exit on illegal callsFlaper Fesp-15/+33
2013-08-27Testing rekillable fails when called from outside an unkillable blockFlaper Fesp-1/+17
2013-08-27Make rekillable consistent with unkillableFlaper Fesp-16/+27
As for now, rekillable is an unsafe function, instead, it should behave just like unkillable by encapsulating unsafe code within an unsafe block. This patch does that and removes unsafe blocks that were encapsulating rekillable calls throughout rust's libs. Fixes #8232
2013-08-23auto merge of #8677 : bblum/rust/scratch, r=alexcrichtonbors-45/+32
r anybody; there isn't anything complicated here
2013-08-22Enabled unit tests in std and extra.Vadim Chugunov-26/+19
2013-08-21std/extra: changing XXX to FIXME; cleanupTim Chevalier-1/+1
* Get rid of by-value-self workarounds; it works now * Remove type annotations, they're not needed anymore
2013-08-20small cleanups in task/spawn.rsBen Blum-45/+32
2013-08-19Add externfn macro and correctly label fixed_stack_segmentsNiko Matsakis-12/+15
2013-08-18auto merge of #8560 : kballard/rust/reserve-yield, r=pcwaltonbors-15/+15
Rename task::yield() to task::deschedule(). Fixes #8494.
2013-08-16Reserve 'yield' keywordKevin Ballard-15/+15
Rename task::yield() to task::deschedule(). Fixes #8494.
2013-08-16doc: correct spelling in documentation.Huon Wilson-3/+3
2013-08-12Clean up transitionary glue in task/spawn.rs. Don't hold kill-little-lock ↵Ben Blum-130/+63
for O(n) time, cf #3100, and optimize out several unneeded clone()s.
2013-08-10Mass rename of .consume{,_iter}() to .move_iter()Erick Tryzelaar-5/+5
cc #7887
2013-08-09Remove the C++ runtime. SayonaraBrian Anderson-307/+48
2013-08-09std: Fix perf of local allocations in newschedBrian Anderson-16/+16
Mostly optimizing TLS accesses to bring local heap allocation performance closer to that of oldsched. It's not completely at parity but removing the branches involved in supporting oldsched and optimizing pthread_get/setspecific to instead use our dedicated TCB slot will probably make up for it.
2013-08-08Enabled workstealing in the scheduler. Previously we had one global work ↵toddaaro-1/+8
queue shared by each scheduler. Now there is a separate work queue for each scheduler, and work is "stolen" from other queues when it is exhausted locally.
2013-08-07Disable linked failure testsBrian Anderson-0/+19
The implementation currently contains a race that leads to segfaults.
2013-08-07std: Allow spawners to specify stack sizeBrian Anderson-11/+15
2013-08-07core: option.map_consume -> option.map_moveErick Tryzelaar-3/+3
2013-08-06auto merge of #8317 : bblum/rust/fast-spawn-unlinked, r=brsonbors-45/+59
This lazily initializes the taskgroup structs for ```spawn_unlinked``` tasks. If such a task never spawns another task linked to it (or a descendant of it), its taskgroup is simply never initialized at all. Also if an unlinked task spawns another unlinked task, neither of them will need to initialize their taskgroups. This works for the main task too. I benchmarked this with the following test case and observed a ~~21% speedup (average over 4 runs: 7.85 sec -> 6.20 sec, 2.5 GHz)~~ 11% speedup, see comment below. ``` use std::task; use std::cell::Cell; use std::rt::comm; static NUM: uint = 1024*256; fn run(f: ~fn()) { let mut t = task::task(); t.unlinked(); t.spawn(f); } fn main() { do NUM.times { let (p,c) = comm::oneshot(); let c = Cell::new(c); do run { c.take().send(()); } p.recv(); } } ```
2013-08-05Lazily initialize 'leaf node' taskgroups for unlinked spawns, for an ↵Ben Blum-45/+59
apparent 11% speedup.