Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move `std::thread_local::*` into `std::thread` #909

Merged
merged 2 commits into from Mar 20, 2015

Conversation

Projects
None yet
7 participants
@carllerche
Copy link
Member

carllerche commented Feb 25, 2015

Propose moving the contents of std::thread_local::* into std::thread

Rendered

@CloudiDust

This comment has been minimized.

Copy link
Contributor

CloudiDust commented Feb 26, 2015

+1 to std::thread_local -> std::thread::local.

Though this is a breaking change, it is also a small one, and if I am reading #911 correctly, then there may be breaking changes to std::thread_local (specially s::t::Key) anyway.

@blaenk

This comment has been minimized.

Copy link
Contributor

blaenk commented Feb 27, 2015

Good idea.

@liigo

This comment has been minimized.

Copy link
Contributor

liigo commented Feb 27, 2015

Both std::thread::local and std::thread::tls are good places.

@jmesmon

This comment has been minimized.

Copy link

jmesmon commented Feb 27, 2015

tls is an initialism that expands to thread_local_storage, so it'd be a little funny, one could read it as std::thread::thread_local_storage.

On std::thread::local : are we really sure that the only thing that will ever be local to threads is storage? And does local actually describe what we're using? (local is an adjective in it's usage in tls, storage is a noun)

All that said: the current name suffers from some of my nit-picking as well, so it isn't really an excuse not to change what we have now to one of the proposed items.

@aturon

This comment has been minimized.

Copy link
Member

aturon commented Feb 28, 2015

This is a great idea! The fact that thread_local ended up as a separate top-level module was mostly an accident of stabilization history.

A submodule called local is a reasonable idea; I want to chew on it a little bit more. But strong 👍 to merging in some fashion.

@CloudiDust

This comment has been minimized.

Copy link
Contributor

CloudiDust commented Mar 1, 2015

@jmesmon When people talk about "thread locals" (note here local is used like a noun), I tend to assume that they are referring to "thread local storage/variables", though technically there are other things that are local to threads. So I am fine with std::thread::local.

Also, I believe we can "repurpose" the module a bit, and actually put other thread local entities inside std::thread::local if we want to.

@aturon aturon self-assigned this Mar 5, 2015

@aturon

This comment has been minimized.

Copy link
Member

aturon commented Mar 17, 2015

Since there's very little in thread_local today, I wonder if we could instead import the contents with a prefix: LocalKey and ScopedKey perhaps?

@CloudiDust

This comment has been minimized.

Copy link
Contributor

CloudiDust commented Mar 18, 2015

@aturon, LocalKey and ScopedKey are good names. I do wonder if we have plans to add things to std::thread_local/std::thread::local? If not, then we can deprecate std::thread_local and move the two types to std::thread.

@aturon

This comment has been minimized.

Copy link
Member

aturon commented Mar 19, 2015

@carllerche Can you update the RFC with the LocalKey and ScopedKey proposal? It was discussed by the core team today and is otherwise ready to be accepted.

@aturon

This comment has been minimized.

Copy link
Member

aturon commented Mar 20, 2015

This RFC, which is a minor organizational tweak, has been approved. The final decision was to use LocalKey and ScopedKey; I updated the RFC accordingly (as per @carllerche's request on IRC).

Tracking issue

aturon added a commit to aturon/rust that referenced this pull request Mar 20, 2015

Implement RFC 909: move thread_local into thread
This commit implements [RFC
909](rust-lang/rfcs#909):

The `std::thread_local` module is now deprecated, and its contents are
available directly in `std::thread` as `LocalKey`, `LocalKeyState`, and
`ScopedKey`.

The macros remain exactly as they were.

[breaking-change]

aturon added a commit to aturon/rust that referenced this pull request Mar 20, 2015

Implement RFC 909: move thread_local into thread
This commit implements [RFC
909](rust-lang/rfcs#909):

The `std::thread_local` module is now deprecated, and its contents are
available directly in `std::thread` as `LocalKey`, `LocalKeyState`, and
`ScopedKey`.

The macros remain exactly as they were, which means little if any code
should break. Nevertheless, this is technically a:

[breaking-change]

Closes rust-lang#23547

aturon added a commit to aturon/rust that referenced this pull request Mar 20, 2015

Implement RFC 909: move thread_local into thread
This commit implements [RFC
909](rust-lang/rfcs#909):

The `std::thread_local` module is now deprecated, and its contents are
available directly in `std::thread` as `LocalKey`, `LocalKeyState`, and
`ScopedKey`.

The macros remain exactly as they were, which means little if any code
should break. Nevertheless, this is technically a:

[breaking-change]

Closes rust-lang#23547

aturon added a commit to aturon/rust that referenced this pull request Mar 20, 2015

Implement RFC 909: move thread_local into thread
This commit implements [RFC
909](rust-lang/rfcs#909):

The `std::thread_local` module is now deprecated, and its contents are
available directly in `std::thread` as `LocalKey`, `LocalKeyState`, and
`ScopedKey`.

The macros remain exactly as they were, which means little if any code
should break. Nevertheless, this is technically a:

[breaking-change]

Closes rust-lang#23547

aturon added a commit to aturon/rust that referenced this pull request Mar 23, 2015

Implement RFC 909: move thread_local into thread
This commit implements [RFC
909](rust-lang/rfcs#909):

The `std::thread_local` module is now deprecated, and its contents are
available directly in `std::thread` as `LocalKey`, `LocalKeyState`, and
`ScopedKey`.

The macros remain exactly as they were, which means little if any code
should break. Nevertheless, this is technically a:

[breaking-change]

Closes rust-lang#23547

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Mar 23, 2015

rollup merge of rust-lang#23557: aturon/rfc-909
This commit implements [RFC 909](rust-lang/rfcs#909):

The `std::thread_local` module is now deprecated, and its contents are
available directly in `std::thread` as `LocalKey`, `LocalKeyState`, and
`ScopedKey`.

The macros remain exactly as they were, which means little if any code
should break. Nevertheless, this is technically a:

[breaking-change]

Closes rust-lang#23547

@Centril Centril added the A-threads label Nov 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.