Commit Graph

176 Commits

Author SHA1 Message Date
Felix Raimundo 656efcd3ab Address review comments 2017-05-09 16:57:03 +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
bors 8aad3a3524 Auto merge of #41768 - rap2hpoutre:patch-4, r=frewsxcv
Add an example to std::thread::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::thread::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
bors 14481f7210 Auto merge of #41008 - sagebind:thread_id, r=alexcrichton
Derive Hash for ThreadId + better example

Derive `Hash` for `ThreadId` (see comments in #21507). Useful for making maps based on thread, e.g. `HashMap<ThreadId, ?>`. Also update example code for thread IDs to be more useful.
2017-04-12 19:58:10 +00:00
Oliver Middleton b4be475836 Fix Markdown issues in the docs
* Since the switch to pulldown-cmark reference links need a blank line
before the URLs.
* Reference link references are not case sensitive.
* Doc comments need to be indented uniformly otherwise rustdoc gets
confused.
2017-04-06 12:57:40 +01:00
Stephen M. Coakley cd14a323f4 Use derived Debug for ThreadId 2017-04-04 10:44:57 -05:00
Stephen M. Coakley 2820295266 Derive Hash for ThreadId + better example 2017-04-03 01:23:52 -05:00
Simon Sapin 509ef4c496 std::thread docs: fix link to current() 2017-04-02 12:03:54 +02:00
Corey Farwell d7a09d4e65 Rollup merge of #40503 - swgillespie:thread-hack-removal, r=sfackler
std: remove a workaround for privacy limitations

`std::thread::Thread` implements a non-exported `NewThread` trait to allow for internal-only use of `Thread::new`. Nowadays we have `pub(crate)`, which accomplishes the same thing but much more idiomatically.

Rustdoc handles this correctly (I checked and I didn't see `Thread::new` on the rustdoc entry for `Thread` with this change), and the stage1 `rustc` emits the correct error still (I'm assuming that the stage1 compiler uses my `libstd`?):

```
$ ./build/x86_64-apple-darwin/stage1/bin/rustc test.rs
error: method `new` is private
 --> test.rs:4:18
  |
4 |     let thread = thread::Thread::new(None);
  |                  ^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error
```
2017-03-17 08:49:02 -04:00
Corey Farwell dee6989b43 Rollup merge of #40457 - frewsxcv:frewsxcv-macos, r=steveklabnik
Update usages of 'OSX' (and other old names) to 'macOS'.

As of last year with version 'Sierra', the Mac operating system is now
called 'macOS'.
2017-03-17 08:48:52 -04:00
Corey Farwell e7b0f2badf Remove function invokation parens from documentation links.
This was never established as a convention we should follow in the 'More
API Documentation Conventions' RFC:

https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
2017-03-13 21:43:18 -04:00
Sean Gillespie 1545f4e2a3 std: remove a workaround for privacy limitations that isn't necessary anymore 2017-03-13 18:42:23 -07:00
Corey Farwell 97a1b6a055 Update usages of 'OSX' (and other old names) to 'macOS'.
As of last year with version 'Sierra', the Mac operating system is now
called 'macOS'.
2017-03-12 14:59:04 -04:00
Aleksey Kladov 689dc26b68 Clarify thread::Builder::stack_size 2017-02-22 17:13:22 +03:00
Stjepan Glavina 1fbbe79bcb Fix wording in LocalKey documentation 2017-02-15 23:31:51 +01:00
Oliver Middleton 9128f6100c Fix a few impl stability attributes
The versions show up in rustdoc.
2017-01-29 13:31:47 +00:00
Oliver Middleton 09b3903aec Fix a few links in the docs 2017-01-27 18:08:51 +00:00
Alex Crichton 437d2b5e28 Rollup merge of #38761 - frewsxcv:thread-sleep-formatting, r=alexcrichton
Add 'platform-specific' section to `sleep_ms` to match `sleep`.

None
2017-01-20 08:34:30 -08:00
bors 07191e2b11 Auto merge of #38548 - GuillaumeGomez:thread_struct_docs, r=frewsxcv
Add missing example for Thread struct

r? @frewsxcv
2017-01-01 22:45:02 +00:00
Corey Farwell 20fd6cc98a Add 'platform-specific' section to sleep_ms to match sleep. 2017-01-01 11:53:18 -08:00
Guillaume Gomez 3312febf22 Add missing example for Thread struct 2016-12-31 13:10:44 +01:00
Alex Crichton 26f28ec96d Rollup merge of #38491 - GuillaumeGomez:builder_docs, r=frewsxcv
Builder docs

r? @frewsxcv
2016-12-29 17:26:13 -08:00
Steve Klabnik df63b0ce72 Rollup merge of #38572 - GuillaumeGomez:join_handle_docs, r=frewsxcv
Add JoinHandle missing examples

r? @frewsxcv
2016-12-24 14:29:34 -05:00
Guillaume Gomez 00645e8504 Add JoinHandle missing examples 2016-12-24 10:40:27 +01:00
Guillaume Gomez 292d36febd Add missing doc examples for Builder 2016-12-24 10:37:04 +01:00
Guillaume Gomez 99529825e8 Add missing examples in some thread functions 2016-12-21 18:05:11 +01:00
Alex Crichton 68dd6fd964 Rollup merge of #38006 - frewsxcv:libstd-debug, r=alexcrichton
Implement `fmt::Debug` for all structures in libstd.

Part of https://github.com/rust-lang/rust/issues/31869.

Also turn on the `missing_debug_implementations` lint at the crate
level.
2016-12-20 11:16:17 -08:00
Corey Farwell 86fc63e62d Implement fmt::Debug for all structures in libstd.
Part of https://github.com/rust-lang/rust/issues/31869.

Also turn on the `missing_debug_implementations` lint at the crate
level.
2016-12-18 14:55:14 -08:00
Guillaume Gomez 79e8a70b62 Add missing urls for thread doc module 2016-12-18 11:36:13 +01:00
Brian Anderson 8b2600dbf9 Document reasoning for supporting both fast and OS TLS in the same bin 2016-11-01 17:08:24 +00:00
Brian Anderson 568840707c std: Move elf TLS to sys::fast_thread_local 2016-11-01 17:08:24 +00:00
Raph Levien 76bac5d33e Add Fuchsia support
Adds support for the x86_64-unknown-fuchsia target, which covers the
Fuchsia operating system.
2016-10-22 07:08:06 -07:00
bors 6d620843f6 Auto merge of #36341 - sagebind:thread_id, r=alexcrichton
Add ThreadId for comparing threads

This adds the capability to store and compare threads with the current calling thread via a new struct, `std::thread::ThreadId`. Addresses the need outlined in issue #21507.

This avoids the need to add any special checks to the existing thread structs and does not rely on the system to provide an identifier for a thread, since it seems that this approach is unreliable and undesirable. Instead, this simply uses a lazily-created, thread-local `usize` whose value is copied from a global atomic counter. The code should be simple enough that it should be as much reliable as the `#[thread_local]` attribute it uses (however much that is).

`ThreadId`s can be compared directly for equality and have copy semantics.

Also see these other attempts:
- rust-lang/rust#29457
- rust-lang/rust#29448
- rust-lang/rust#29447

And this in the RFC repo: rust-lang/rfcs#1435
2016-10-10 04:04:51 -07:00
Stephen M. Coakley 032bffa5b8 Unlock guard before overflow panic 2016-10-07 17:45:04 -05:00
Stephen M. Coakley e80fd2531b Use mutex to guard thread ID counter 2016-10-05 18:11:28 -05:00
Stephen M. Coakley 894ef966c6 Generate ID using u64 + atomic spinlock 2016-10-05 11:34:25 -05:00
bors 8b00355119 Auto merge of #36339 - brson:emscripten-new, r=alexcrichton
Working asmjs and wasm targets

This patch set results in a working standard library for the asmjs-unknown-emscripten and wasm32-unknown-emscripten targets. It is based on the work of @badboy and @rschulman.

It does a few things:

- Updates LLVM with the emscripten [fastcomp](https://github.com/rust-lang/llvm/pull/50) patches, which include the pnacl IR legalizer and the asm.js backend. This patch is thought not to have any significant effect on existing targets.
- Teaches rustbuild to correctly link C code with emscripten
- Updates gcc-rs to work correctly with emscripten
- Teaches rustbuild to run crate tests for emscripten with node
- Modifies Thread::new to return an error on emscripten, to facilitate debugging a common failure mode
- Modifies libtest to run in single-threaded mode for emscripten
- Ignores a host of tests that don't work yet, mostly dealing with threads and I/O
- Updates libc with wasm32 definitions (presently the same as asmjs)
- Adds a wasm32-unknown-emscripten target that feeds the output of LLVM's asmjs backend through emcc to generate wasm

Notes and caveats:

- This is only known to work with `--enable-rustbuild`.
- The wasm32 target can't be tested correctly yet because of issues in compiletest and limitations in node https://github.com/kripken/emscripten/issues/4542, but hello.rs does seem to work when run on node via the binaryen interpreter
- This requires an up to date installation of the emscripten sdk from its incoming branch
- Unwinding is very broken
- When enabling the emscripten targets jemalloc is disabled for all targets, which results in test failures for the host

Next steps are to fix the jemalloc issue, start building the two emscripten targets on the auto builders, then start producing nightlies.

https://github.com/rust-lang/rust/issues/36317 tracks work on this.

Fixes https://github.com/rust-lang/rust/issues/36515
Fixes https://github.com/rust-lang/rust/issues/36515
Fixes https://github.com/rust-lang/rust/issues/36356
2016-09-30 19:00:36 -07:00
Brian Anderson 096670ca41 Ignore various entire test modules on emscripten 2016-09-30 14:02:56 -07:00
Brian Anderson 9c4a01ee9e Ignore lots and lots of std tests on emscripten 2016-09-30 14:02:48 -07:00
Guillaume Gomez f6ab636b86 Update to new macro url syntax 2016-09-16 17:59:24 +02:00