rust/src
Alex Crichton 36f5d122b8 rollup merge of #20615: aturon/stab-2-thread
This commit takes a first pass at stabilizing `std::thread`:

* It removes the `detach` method in favor of two constructors -- `spawn`
  for detached threads, `scoped` for "scoped" (i.e., must-join)
  threads. This addresses some of the surprise/frustrating debug
  sessions with the previous API, in which `spawn` produced a guard that
  on destruction joined the thread (unless `detach` was called).

  The reason to have the division in part is that `Send` will soon not
  imply `'static`, which means that `scoped` thread creation can take a
  closure over *shared stack data* of the parent thread. On the other
  hand, this means that the parent must not pop the relevant stack
  frames while the child thread is running. The `JoinGuard` is used to
  prevent this from happening by joining on drop (if you have not
  already explicitly `join`ed.) The APIs around `scoped` are
  future-proofed for the `Send` changes by taking an additional lifetime
  parameter. With the current definition of `Send`, this is forced to be
  `'static`, but when `Send` changes these APIs will gain their full
  flexibility immediately.

  Threads that are `spawn`ed, on the other hand, are detached from the
  start and do not yield an RAII guard.

  The hope is that, by making `scoped` an explicit opt-in with a very
  suggestive name, it will be drastically less likely to be caught by a
  surprising deadlock due to an implicit join at the end of a scope.

* The module itself is marked stable.

* Existing methods other than `spawn` and `scoped` are marked stable.

The migration path is:

```rust
Thread::spawn(f).detached()
```

becomes

```rust
Thread::spawn(f)
```

while

```rust
let res = Thread::spawn(f);
res.join()
```

becomes

```rust
let res = Thread::scoped(f);
res.join()
```

[breaking-change]
2015-01-06 15:38:38 -08:00
..
compiler-rt@62a4ca6055
compiletest rollup merge of #20615: aturon/stab-2-thread 2015-01-06 15:38:38 -08:00
doc rollup merge of #20615: aturon/stab-2-thread 2015-01-06 15:38:38 -08:00
driver
etc rollup merge of #20643: scialex/update-zsh 2015-01-06 15:25:02 -08:00
grammar Un-gate macro_rules 2015-01-05 18:21:14 -08:00
jemalloc@b001609960
liballoc rollup merge of #20615: aturon/stab-2-thread 2015-01-06 15:38:38 -08:00
libarena sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rs 2015-01-03 22:54:18 -05:00
libbacktrace
libcollections rollup merge of #20615: aturon/stab-2-thread 2015-01-06 15:38:38 -08:00
libcore rollup merge of #20615: aturon/stab-2-thread 2015-01-06 15:38:38 -08:00
libcoretest rollup merge of #20607: nrc/kinds 2015-01-06 15:34:10 -08:00
libflate Register new snapshots 2015-01-06 15:24:24 -08:00
libfmt_macros Register new snapshots 2015-01-06 15:24:24 -08:00
libgetopts Register new snapshots 2015-01-06 15:24:24 -08:00
libgraphviz Register new snapshots 2015-01-06 15:24:24 -08:00
liblibc rollup merge of #20607: nrc/kinds 2015-01-06 15:34:10 -08:00
liblog Register new snapshots 2015-01-06 15:24:24 -08:00
librand rollup merge of #20607: nrc/kinds 2015-01-06 15:34:10 -08:00
librbml Register new snapshots 2015-01-06 15:24:24 -08:00
libregex Register new snapshots 2015-01-06 15:24:24 -08:00
librustc rollup merge of #20607: nrc/kinds 2015-01-06 15:34:10 -08:00
librustc_back Register new snapshots 2015-01-06 15:24:24 -08:00
librustc_borrowck Register new snapshots 2015-01-06 15:24:24 -08:00
librustc_driver rollup merge of #20615: aturon/stab-2-thread 2015-01-06 15:38:38 -08:00
librustc_llvm Register new snapshots 2015-01-06 15:24:24 -08:00
librustc_resolve rollup merge of #20653: alexcrichton/entry-unstable 2015-01-06 15:29:18 -08:00
librustc_trans rollup merge of #20615: aturon/stab-2-thread 2015-01-06 15:38:38 -08:00
librustc_typeck rollup merge of #20607: nrc/kinds 2015-01-06 15:34:10 -08:00
librustdoc rollup merge of #20615: aturon/stab-2-thread 2015-01-06 15:38:38 -08:00
libserialize rollup merge of #20593: nikomatsakis/unused-tps-in-impl 2015-01-06 15:31:39 -08:00
libstd rollup merge of #20615: aturon/stab-2-thread 2015-01-06 15:38:38 -08:00
libsyntax rollup merge of #19430: pczarn/interp_tt-cleanup 2015-01-06 15:38:10 -08:00
libterm Register new snapshots 2015-01-06 15:24:24 -08:00
libtest rollup merge of #20615: aturon/stab-2-thread 2015-01-06 15:38:38 -08:00
libunicode rollup merge of #20607: nrc/kinds 2015-01-06 15:34:10 -08:00
llvm@ec1fdb3b9d core: split into fmt::Show and fmt::String 2015-01-06 14:49:42 -08:00
rt Initial version of AArch64 support. 2015-01-03 15:16:10 +00:00
rust-installer@3a37981744 core: split into fmt::Show and fmt::String 2015-01-06 14:49:42 -08:00
rustllvm Ensure that LLVM is rebuilt with recent changes 2015-01-05 18:40:41 +01:00
test rollup merge of #20615: aturon/stab-2-thread 2015-01-06 15:38:38 -08:00
snapshots.txt Register new snapshots 2015-01-06 15:24:24 -08:00