Commit Graph

171 Commits

Author SHA1 Message Date
Mark Simulacrum
25e5f0a48d Rollup merge of #43456 - joshlf:spawn-doc-grammar, r=alexcrichton
std:🧵:spawn: Fix grammar in documentation

Closes #43435.
2017-07-26 06:15:04 -06:00
Joshua Liebow-Feeser
8aa8f80ac0 std:🧵:spawn: Fix grammar in documentation 2017-07-24 11:17:29 -07:00
Bruce Mitchener
539df8121b Fix some doc/comment typos. 2017-07-23 22:48:01 +07:00
Lee Bousfield
8b5549defb Fix @alexcrichton comments 2017-07-11 11:04:19 -04:00
Steven Fackler
dc411e307a Stabilize ThreadId
Closes #21507
2017-06-24 19:19:26 -07:00
Alex Crichton
06540cb205 rustc: Enable #[thread_local] for Windows
I think LLVM has had support for quite some time now for this, we just never got
around to testing it out and binding it. We've had some trouble landing this in
the past I believe, but it's time to try again!

This commit flags the `#[thread_local]` attribute as being available for Windows
targets and adds an implementation of `register_dtor` in the `thread::local`
module to ensure we can destroy these keys. The same functionality is
implemented in clang via a function called `__tlregdtor` (presumably provided in
some Windows runtime somewhere), but this function unfortunately does not take a
data pointer (just a thunk) which means we can't easily call it. For now
destructors are just run in the same way the Linux fallback is implemented,
which is just keeping track via a single OS-based TLS key.
2017-06-23 16:11:39 -07:00
Mark Buer
0389d40ce0 Capture elapsed duration in Thread::park_timeout example 2017-06-12 13:43:58 +09:30
Mark Simulacrum
32f418f60a Rollup merge of #41981 - gamazeps:thread-detach, r=frewsxcv
[Doc] Expands `detach` documentation in `thread::JoinHande`.

Part of #29378 .

- Adds an example of a thread detaching.
- Expands what `detaching` means.

r? @steveklabnik
2017-06-02 09:10:41 -06:00
Felix Raimundo
b76b9e1467 Expands detach documentation in thread::JoinHande.
Part of #29378 .

- Adds an example of a thread detaching.
- Expands what `detaching` means.
2017-06-02 12:26:04 +02:00
Mark Simulacrum
8bac98a252 Rollup merge of #42141 - ids1024:nobacktrace, r=aturon
Fix building std without backtrace feature, which was broken in ca8b754

Fixes #42139
2017-05-24 19:50:02 -06:00
Mark Simulacrum
f4780a3f7c Rollup merge of #41980 - gamazeps:thread-send, r=steveklabnik
[Doc] Add `'static` and `Send` constraints explanations to `thread::spawn`

Part of #29378.

Explains why the constraints on the closure and its return value are `'static` and `Send`.

Allows to tick of `thread::spawn` from the list of things to document in the `thread` module.

r? @steveklabnik
2017-05-24 19:49:59 -06:00
Ian Douglas Scott
66237afce4 Fix building without backtrace feature, which was broken in ca8b754
Fixes #42139
2017-05-21 12:38:07 -07:00
Mark Simulacrum
18171a8861 Rollup merge of #41994 - gamazeps:thread-builder, r=GuillaumeGomez
[Doc] Implrove `thread::Builder`'s doc.

Part of #29378 .

- Explains *why* we would use the builder instead ofthe free function.
- Changes the parent-child explanation for a spawned-caller in `thread::Builder::spawn`
- Adds a link to `io::Result` in `thread::Builder`
- Corrects the return type doc in `thread::Builder::spawn`

r? @rust-lang/docs
2017-05-16 08:18:30 -06:00
Felix Raimundo
a51777ec87 Improve thread::Builder documentation.
Part of #29378 .

- In particular explains *why* we would use the builder instead of
  the free function.
- Changes the parent-child explanation for a spawned-caller.
- Add link to `io::Result` in `thread::Builder`
- Corrects the `thread::Builder::spawn` documentation.
2017-05-14 20:13:32 +02:00
Felix Raimundo
770bd57ea5 Add 'static and Send constraints explanations to thread::spawn
Part of #29378.
2017-05-14 14:14:42 +02:00
Felix Raimundo
a9cb094879 Explain why thread::yield_now could be used.
Part of #29378.
2017-05-14 14:05:10 +02:00
Mark Simulacrum
605d727bb3 Rollup merge of #41896 - tshepang:too-long, r=steveklabnik
doc: break into 2 sentences
2017-05-12 18:57:29 -06:00
Tshepang Lekhonkhobe
e42875ce6d doc: break into 2 sentences 2017-05-11 06:27:01 +02:00
Steve Klabnik
42ce11eb5a Rollup merge of #41854 - gamazeps:thread-spawn-doc, r=steveklabnik
[Doc] Improve `thread::spawn` documentation

Part of #29378

- Add two examples to `thread::spawn` doumentation that show common uses of threads.
- Add a link to `thread::Builder` in the `thread::spawn` documentation for configuring threads.
- Add a link to `thread::spawn` in `thread::Builder` in order to avoid documentation duplication.

r? @steveklabnik
2017-05-10 17:18:33 +02:00
Steve Klabnik
ec85859d9a Rollup merge of #41809 - gamazeps:thread-docs, r=steveklabnik
[DOC] Improve the thread::park and thread::unpark documentation

Part of #29378 .

Takes care of the documentation for `park`, `park_duration` and also improves the `unpark` example.

- `park should` have its module documentation inlined here, and cleaned up.
- `park_timeout` could use links to `park`.
2017-05-10 17:18:32 +02:00
bors
25a161765f Auto merge of #41815 - Yamakaky:improve-backtrace-bottom, r=alexcrichton
Improve cleaning of the bottom of the backtrace

Following https://github.com/rust-lang/rust/pull/40264. It only cleans the bottom of the trace (after the main). It handles correctly the normal main, tests, benchmarks and threads.

I kept `skipped_before` since it will be used later for the cleaning of the top.
2017-05-10 11:37:22 +00:00
Felix Raimundo
fe7b6db39b Fix typos in doc 2017-05-10 10:44:58 +02:00
Yamakaky
ca8b75466c Don't show the std frames before user code on unwinding.
When `RUST_BACKTRACE=1`, remove all frames after
`__rust_maybe_catch_panic`. Tested on `main`, threads, tests and
benches. Cleaning of the top of the stacktrace is let to a future PR.

Fixes #40201

See #41815
2017-05-09 19:51:50 +02:00
Felix Raimundo
202086e48f Fix warnings in examples 2017-05-09 19:06:56 +02:00
Felix Raimundo
afe74c3900 Fix link 2017-05-09 19:02:43 +02:00
bors
644fc403dd Auto merge of #41814 - gamazeps:thread-struct-doc, r=steveklabnik
[Doc] improve `thread::Thread` and `thread::Builder` documentations

Part of #29378

- Adds information about the stack_size when using `Builder`. This might be considered too low level, but I assume that if someone wants to create their own builder instead of using `thread::spawn` they may be interested in that info.
- Updates the `thread::Thread` structure doc, mostly by explaining how to get one, the previous example was removed because it was not related to `thread::Thread`, but rather to `thread::Builder::name`.
  Not much is present there, mostly because this API is not often used (the only method that seems useful is `unpark`, which is documented in #41809).
2017-05-09 16:31:07 +00:00
Felix Raimundo
656efcd3ab Address review comments 2017-05-09 16:57:03 +02:00
Felix Raimundo
323a774c2f Address review comments 2017-05-09 16:52:26 +02:00
Felix Raimundo
9db31206f5 Add a link to thread::Builder in thread::spawn 2017-05-09 13:27:22 +02:00
Felix Raimundo
c655348f26 Add more examples to thread::spawn
Part of #29378
2017-05-09 13:20:04 +02:00
Felix Raimundo
03c9510525 Fix typos in thread::park documentation. 2017-05-07 21:50:44 +02:00
Felix Raimundo
c9e5eab6ff Update the thread::Thread documentation.
- Copied the module documentation to `Thread`.
- Removed the example because it did not use any method of Thread.
2017-05-07 19:31:20 +02:00
Felix Raimundo
ddb9e50b45 Add stack size doc to thread::spawn.
Part of #29378
2017-05-07 19:31:17 +02:00
Felix Raimundo
fa0cdaa63f Inline thread::park documentation.
Part of #29378

- Moves the module documentation into `park`.
- Add the same example as the one from `unpark` to `park`.
2017-05-07 19:10:44 +02:00
Felix Raimundo
12efc9d0fa Improve thread::panicking documentaion.
Part of #29378
2017-05-07 18:40:06 +02:00
Felix Raimundo
c0d475ad7b fix typo 2017-05-07 16:22:13 +02:00
Felix Raimundo
5573c4709c Better example for thread::unpark.
Part of #29378
2017-05-07 16:01:47 +02:00
Felix Raimundo
d9628f9389 Add park info to unpark.
- Adds an explanantion of what `park` does in the `unpark` documentation.
- Adds a link to the module doc.
2017-05-07 13:54:06 +02:00
Felix Raimundo
c158962169 Add link to the module doc in park_timeout.
Part of #29378
2017-05-07 13:50:23 +02:00
Felix Raimundo
061b56bd5c Add a link to park in the park_timeout doc.
Part of #29378
2017-05-07 13:47:39 +02:00
bors
8aad3a3524 Auto merge of #41768 - rap2hpoutre:patch-4, r=frewsxcv
Add an example to std:🧵:Result type

This PR is a part of https://github.com/rust-lang/rust/issues/29378. I submit this PR with the help (mentoring) of @steveklabnik. I'm still not sure my request is good enough but I don't want to spoil the issue with too much questions so I continue here. r? @steveklabnik
2017-05-06 02:01:00 +00:00
Alex Crichton
94e4b459ef std: Prevent deadlocks in doctests on Windows
Windows historically has problems with threads panicking and the main thread
exiting at the same time, typically causing deadlocks. In the past (#25824)
we've joined on threads but this just prevents running the test for now to avoid
tampering with the example.
2017-05-05 11:27:45 -07:00
Raphaël Huchet
71aaab1c36 Update mod.rs 2017-05-05 12:07:14 +02:00
Raphaël Huchet
68bb541462 Add an example to std:🧵:Result type 2017-05-05 12:02:02 +02:00
Raphaël Huchet
93e179a8c1 Update mod.rs 2017-05-04 14:04:03 +02:00
Raphaël Huchet
3a07155a9d create link to Result 2017-05-04 11:33:26 +02:00
Raphaël Huchet
a3998ad6e5 Join method returns a thread::Result 2017-05-04 11:11:14 +02:00
Christian Poveda
cf521211a1 restructured docs for thread and added links 2017-04-26 11:54:17 -05:00
Christian Poveda
bdb6bb9684 added move 2017-04-26 00:57:59 -05:00
Christian Poveda
08514b4376 rewrote the thread struct docs 2017-04-25 17:22:34 -05:00