<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/src/libstd/thread, branch 1.31.1</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=1.31.1</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=1.31.1'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2018-10-18T04:54:42+00:00</updated>
<entry>
<title>Rollup merge of #54646 - vn971:fix_std_thread_sleep, r=frewsxcv</title>
<updated>2018-10-18T04:54:42+00:00</updated>
<author>
<name>kennytm</name>
<email>kennytm@gmail.com</email>
</author>
<published>2018-10-18T02:47:17+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=e4ac4478514779d956cbc51068ec2d3207083bfa'/>
<id>urn:sha1:e4ac4478514779d956cbc51068ec2d3207083bfa</id>
<content type='text'>
improve documentation on std::thread::sleep
</content>
</entry>
<entry>
<title>improve docs on thread::sleep</title>
<updated>2018-10-11T18:37:30+00:00</updated>
<author>
<name>Vasya Novikov</name>
<email>n1dr+cm3513git@ya.ru</email>
</author>
<published>2018-10-11T18:37:30+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=7a0fa95336439120d89bb2f6116146011fd40307'/>
<id>urn:sha1:7a0fa95336439120d89bb2f6116146011fd40307</id>
<content type='text'>
</content>
</entry>
<entry>
<title>std: Implement TLS for wasm32-unknown-unknown</title>
<updated>2018-10-11T16:57:55+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2018-10-10T06:10:25+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=cbe9f33b8bb94b262f91bc8c6f61a7f6518164b4'/>
<id>urn:sha1:cbe9f33b8bb94b262f91bc8c6f61a7f6518164b4</id>
<content type='text'>
This adds an implementation of thread local storage for the
`wasm32-unknown-unknown` target when the `atomics` feature is
implemented. This, however, comes with a notable caveat of that it
requires a new feature of the standard library, `wasm-bindgen-threads`,
to be enabled.

Thread local storage for wasm (when `atomics` are enabled and there's
actually more than one thread) is powered by the assumption that an
external entity can fill in some information for us. It's not currently
clear who will fill in this information nor whose responsibility it
should be long-term. In the meantime there's a strategy being gamed out
in the `wasm-bindgen` project specifically, and the hope is that we can
continue to test and iterate on the standard library without committing
to a particular strategy yet.

As to the details of `wasm-bindgen`'s strategy, LLVM doesn't currently
have the ability to emit custom `global` values (thread locals in a
`WebAssembly.Module`) so we leverage the `wasm-bindgen` CLI tool to do
it for us. To that end we have a few intrinsics, assuming two global values:

* `__wbindgen_current_id` - gets the current thread id as a 32-bit
  integer. It's `wasm-bindgen`'s responsibility to initialize this
  per-thread and then inform libstd of the id. Currently `wasm-bindgen`
  performs this initialization as part of the `start` function.
* `__wbindgen_tcb_{get,set}` - in addition to a thread id it's assumed
  that there's a global available for simply storing a pointer's worth
  of information (a thread control block, which currently only contains
  thread local storage). This would ideally be a native `global`
  injected by LLVM, but we don't have a great way to support that right
  now.

To reiterate, this is all intended to be unstable and purely intended
for testing out Rust on the web with threads. The story is very likely
to change in the future and we want to make sure that we're able to do
that!
</content>
</entry>
<entry>
<title>Fix typo in libstd/thread/mod.rs: remove unnecessary comma</title>
<updated>2018-10-06T17:09:54+00:00</updated>
<author>
<name>Artem Varaksa</name>
<email>aymfst@gmail.com</email>
</author>
<published>2018-10-06T17:09:54+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=ddcec08a549bb61e94907affc73738eb7435d45b'/>
<id>urn:sha1:ddcec08a549bb61e94907affc73738eb7435d45b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>update wording for thread::sleep</title>
<updated>2018-10-01T08:01:15+00:00</updated>
<author>
<name>Vasya Novikov</name>
<email>n1dr+cm3513git@ya.ru</email>
</author>
<published>2018-10-01T08:01:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=b63517a2c3bade20ebfbbd328b11ecf9a1558bd2'/>
<id>urn:sha1:b63517a2c3bade20ebfbbd328b11ecf9a1558bd2</id>
<content type='text'>
</content>
</entry>
<entry>
<title>update wording for std::thread::sleep</title>
<updated>2018-09-28T19:40:20+00:00</updated>
<author>
<name>Vasya Novikov</name>
<email>n1dr+cm3513git@ya.ru</email>
</author>
<published>2018-09-28T19:40:20+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=049ccbb174552bac2f19df5361c3470828bf04c4'/>
<id>urn:sha1:049ccbb174552bac2f19df5361c3470828bf04c4</id>
<content type='text'>
</content>
</entry>
<entry>
<title>fix std::thread::sleep typo</title>
<updated>2018-09-28T16:36:53+00:00</updated>
<author>
<name>Vasya Novikov</name>
<email>n1dr+cm3513git@ya.ru</email>
</author>
<published>2018-09-28T16:36:53+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=1a605a6bda22750a1be9e21b988345f343260bb6'/>
<id>urn:sha1:1a605a6bda22750a1be9e21b988345f343260bb6</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Expand synchronization comments in `park`/`unpark`</title>
<updated>2018-09-18T17:06:16+00:00</updated>
<author>
<name>James Duley</name>
<email>james.duley@arm.com</email>
</author>
<published>2018-09-18T16:51:49+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=a3b87058e7e4e590ac2c00215785e62aa5f7bec5'/>
<id>urn:sha1:a3b87058e7e4e590ac2c00215785e62aa5f7bec5</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Add comments and assertion to `park`/`unpark`</title>
<updated>2018-09-14T16:35:12+00:00</updated>
<author>
<name>James Duley</name>
<email>james.duley@arm.com</email>
</author>
<published>2018-09-14T16:32:16+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=f8a78bdfdfffffe74f516eec4303d7f3d4ac879e'/>
<id>urn:sha1:f8a78bdfdfffffe74f516eec4303d7f3d4ac879e</id>
<content type='text'>
regarding the synchronization.
</content>
</entry>
<entry>
<title>Fix `thread` `park`/`unpark` synchronization</title>
<updated>2018-09-12T17:55:44+00:00</updated>
<author>
<name>James Duley</name>
<email>james.duley@arm.com</email>
</author>
<published>2018-09-11T17:04:33+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=204d9608e35f7dc56e179d4539e931766fd88f28'/>
<id>urn:sha1:204d9608e35f7dc56e179d4539e931766fd88f28</id>
<content type='text'>
Previously the code below would not be guaranteed to exit when the first
spawned thread took the `return, // already unparked` path because there
was no write to synchronize with a read in `park`.

```
use std::sync::atomic::{AtomicBool, Ordering};
use std::thread::{current, spawn, park};

static FLAG: AtomicBool = AtomicBool::new(false);

fn main() {
    let thread_0 = current();
    spawn(move || {
        FLAG.store(true, Ordering::Relaxed);
        thread_0.unpark();
    });

    let thread_0 = current();
    spawn(move || {
        thread_0.unpark();
    });

    while !FLAG.load(Ordering::Relaxed) {
        park();
    }
}
```
</content>
</entry>
</feed>
