about summary refs log tree commit diff
path: root/src/libstd/task/mod.rs
AgeCommit message (Collapse)AuthorLines
2013-12-24green: Rip the bandaid off, introduce libgreenAlex Crichton-799/+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-20std: silence warnings when compiling test.Huon Wilson-8/+0
2013-12-16Fallout of rewriting std::commAlex Crichton-51/+21
2013-12-10librustuv: RAII-ify `Local::borrow`, and remove some 12 Cells.Patrick Walton-10/+10
2013-12-10libextra: Another round of de-`Cell`-ing.Patrick Walton-11/+4
34 uses of `Cell` remain.
2013-11-26librustc: Make `||` lambdas not infer to `proc`sPatrick Walton-5/+5
2013-11-26test: Remove non-procedure uses of `do` from compiletest, libstd tests,Patrick Walton-16/+16
compile-fail tests, run-fail tests, and run-pass tests.
2013-11-26libstd: Remove all non-`proc` uses of `do` from libstdPatrick Walton-5/+3
2013-11-24Remove linked failure from the runtimeAlex Crichton-642/+7
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-19libstd: Change all uses of `&fn(A)->B` over to `|A|->B` in libstdPatrick Walton-4/+4
2013-11-18auto merge of #10561 : pcwalton/rust/procify, r=alexcrichtonbors-17/+17
r? @alexcrichton
2013-11-18Remove the C++ lock_and_signal typeAlex Crichton-22/+12
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-17/+17
This makes `Cell`s no longer necessary in most cases.
2013-11-11Remove #[fixed_stack_segment] and #[rust_stack]Alex Crichton-6/+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-01Remove unnecessary unwind messagesAlex Crichton-15/+8
Now that the type_id intrinsic is working across crates, all of these unnecessary messages can be removed to have the failure type for a task truly be ~Any and only ~Any
2013-10-30Prepared `std::sys` for removal, and made `begin_unwind` simplerMarvin Löbel-16/+32
- `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-28Make some more rt components publicAlex Crichton-2/+2
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-40/+125
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-23Removed Unnecessary comments and white spaces #4386reedlepee-11/+8
2013-10-23Making fields in std and extra : private #4386reedlepee-12/+15
2013-10-22Drop the '2' suffix from logging macrosAlex Crichton-27/+27
Who doesn't like a massive renaming?
2013-10-18Made `std::task::TaskBuilder::future_result()` easier to useMarvin Löbel-31/+26
2013-10-07Fix merge fallout of privacy changesAlex Crichton-1/+1
2013-10-07Fix existing privacy/visibility violationsAlex Crichton-1/+1
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-27/+27
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-08-27Consolidate local_data implementations, and cleanupAlex Crichton-1/+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-6/+6
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-22Enabled unit tests in std and extra.Vadim Chugunov-23/+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-19Add externfn macro and correctly label fixed_stack_segmentsNiko Matsakis-9/+6
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-1/+0
for O(n) time, cf #3100, and optimize out several unneeded clone()s.
2013-08-09Remove the C++ runtime. SayonaraBrian Anderson-80/+30