rust/src/libcore
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
..
fmt rollup merge of #20607: nrc/kinds 2015-01-06 15:34:10 -08:00
hash Merge remote-tracking branch 'nrc/sized-2' into rollup 2015-01-05 18:55:41 -08:00
num rollup merge of #20607: nrc/kinds 2015-01-06 15:34:10 -08:00
str rollup merge of #20607: nrc/kinds 2015-01-06 15:34:10 -08:00
any.rs core: split into fmt::Show and fmt::String 2015-01-06 14:49:42 -08:00
array.rs rollup merge of #20607: nrc/kinds 2015-01-06 15:34:10 -08:00
atomic.rs rollup merge of #20615: aturon/stab-2-thread 2015-01-06 15:38:38 -08:00
borrow.rs rollup merge of #20607: nrc/kinds 2015-01-06 15:34:10 -08:00
cell.rs rollup merge of #20607: nrc/kinds 2015-01-06 15:34:10 -08:00
char.rs Stabilization of impls and fallout from stabilization 2015-01-05 14:26:04 -08:00
clone.rs markers -> marker 2015-01-07 12:10:31 +13:00
cmp.rs markers -> marker 2015-01-07 12:10:31 +13:00
default.rs sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rs 2015-01-03 22:54:18 -05:00
finally.rs libcore: fix fallout in doc tests 2014-12-13 17:03:46 -05:00
intrinsics.rs sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rs 2015-01-03 22:54:18 -05:00
iter.rs markers -> marker 2015-01-07 12:10:31 +13:00
lib.rs rollup merge of #20607: nrc/kinds 2015-01-06 15:34:10 -08:00
macros.rs Register new snapshots 2015-01-06 15:24:24 -08:00
marker.rs markers -> marker 2015-01-07 12:10:31 +13:00
mem.rs markers -> marker 2015-01-07 12:10:31 +13:00
nonzero.rs sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rs 2015-01-03 22:54:18 -05:00
ops.rs rollup merge of #20607: nrc/kinds 2015-01-06 15:34:10 -08:00
option.rs Revert "Remove i suffix in docs" 2015-01-05 19:08:37 -08:00
panicking.rs Register new snapshots 2014-12-30 15:04:43 -08:00
prelude.rs rollup merge of #20607: nrc/kinds 2015-01-06 15:34:10 -08:00
ptr.rs markers -> marker 2015-01-07 12:10:31 +13:00
raw.rs markers -> marker 2015-01-07 12:10:31 +13:00
result.rs core: split into fmt::Show and fmt::String 2015-01-06 14:49:42 -08:00
simd.rs sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rs 2015-01-03 22:54:18 -05:00
slice.rs rollup merge of #20607: nrc/kinds 2015-01-06 15:34:10 -08:00
tuple.rs Remove deprecated functionality 2015-01-03 23:43:57 -08:00
ty.rs markers -> marker 2015-01-07 12:10:31 +13:00