]> git.lizzy.rs Git - rust.git/commit
rustrt: Reorganize task usage
authorAlex Crichton <alex@alexcrichton.com>
Fri, 13 Jun 2014 23:03:41 +0000 (16:03 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Thu, 26 Jun 2014 19:40:27 +0000 (12:40 -0700)
commit7d756e44a96c1e28f63cab1ea328d01984ac07d2
tree5941e2f4a5373a63da4ab8bb7979d353cfbd1c8e
parentbab614f5fa725d248afc5f0530c835f37998ce8f
rustrt: Reorganize task usage

Most of the comments are available on the Task structure itself, but this commit
is aimed at making FFI-style usage of Rust tasks a little nicer.

Primarily, this commit enables re-use of tasks across multiple invocations. The
method `run` will no longer unconditionally destroy the task itself. Rather, the
task will be internally re-usable if the closure specified did not fail. Once a
task has failed once it is considered poisoned and it can never be used again.

Along the way I tried to document shortcomings of the current method of tearing
down a task, opening a few issues as well. For now none of the behavior is a
showstopper, but it's useful to acknowledge it. Also along the way I attempted
to remove as much `unsafe` code as possible, opting for safer abstractions.
src/libgreen/lib.rs
src/libgreen/task.rs
src/libnative/lib.rs
src/libnative/task.rs
src/librustrt/local_heap.rs
src/librustrt/task.rs
src/librustrt/unwind.rs
src/libstd/task.rs
src/test/run-pass/fail-during-tld-destroy.rs [new file with mode: 0644]