Commit Graph

158 Commits

Author SHA1 Message Date
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
Stephen M. Coakley 6e10e29a97 Fix tests 2016-09-08 00:08:15 -05:00
Stephen M. Coakley 5bd834bdb4 Add ThreadId for comparing threads 2016-09-07 23:48:07 -05:00
Andrew Paseltiner 8d3fd03855 Clean up thread-local storage docs
`std` no longer contains an implementation of scoped TLS.
2016-09-04 10:16:25 -04:00
Guillaume Gomez 23f769881a Rollup merge of #35997 - matthew-piziak:thread-current-example, r=GuillaumeGomez
add a simple example for `thread::current()`

r? @GuillaumeGomez
2016-08-30 10:39:07 +02:00
Matthew Piziak cf8e1fee16 add a simple example for thread::current() 2016-08-25 16:20:21 -04:00
Jeffrey Seyfried 9a2c8783d9 Use #[prelude_import] in libstd. 2016-08-24 22:12:48 +00:00
Stefan Schindler 20721a4923 Add link to replacement function 2016-08-03 23:12:25 +02:00
Stefan Schindler 4fc6f5ac26 Add an example to std::thread::park_timeout 2016-08-03 23:12:25 +02:00
Guillaume Gomez 5d6b41f3bc Rollup merge of #34406 - frewsxcv:sleep-ex, r=alexcrichton
Add example for `std::thread::sleep`.

None
2016-06-28 16:05:14 +02:00
Corey Farwell a7b9e5441b Add example for std::thread::sleep. 2016-06-27 13:06:20 -04:00
bors 2cfd91d0ce Auto merge of #34465 - frewsxcv:builder-name-example, r=GuillaumeGomez
Add doc example for `std::thread::Builder::name`.

None
2016-06-25 15:47:31 -07:00
bors 91c0d04943 Auto merge of #34410 - frewsxcv:code-like, r=apasel422
Parameters in doc comment should be formatted code-like.

None
2016-06-25 13:01:31 -07:00
Manish Goregaokar 80b352c892 Rollup merge of #34438 - frewsxcv:joinhandle, r=GuillaumeGomez
Indicate how the `JoinHandle` struct is created.

None
2016-06-25 18:16:40 +05:30
Corey Farwell fd388d40ed Add doc example for std::thread::Builder::name. 2016-06-25 07:22:19 -04:00
Corey Farwell 5e9b75e2dd Add examples in docs for JoinHandle. 2016-06-24 12:25:26 -04:00
Corey Farwell 0a6ce30161 Use Option::expect instead of unwrap_or_else with panic!. 2016-06-24 08:19:22 -04:00
Corey Farwell 6e848be5f8 Indicate how the JoinHandle struct is created. 2016-06-24 08:13:30 -04:00
bors 4d9faf3632 Auto merge of #34077 - durka:patch-23, r=alexcrichton
upgrade thread_local! invocation syntax

Allows declaring multiple statics in one macro invocation, and supports attaching attributes to the generated items. In particular, `#![forbid(missing_docs, unused)]` is now tenable on a crate/module containing thread locals.

For an example see [here](https://is.gd/aVFZZF). This change is fully backwards compatible as far as I can tell.

cc @frankmcsherry
2016-06-23 19:22:51 -07:00