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

std: Second pass stabilization for thread_local #20354

Merged
merged 1 commit into from
Jan 2, 2015

Conversation

alexcrichton
Copy link
Member

This commit performs a second pass over the std::thread_local module. Most of
the functionality remains explicitly unstable, but the specific actions taken
were:

  • thread_local is now stable
  • thread_local! is now stable
  • thread_local::Key is now stable
  • thread_local::Key::with is now stable
  • thread_local::Key::destroyed is deprecated in favor of a more general
    state function
  • thread_local::Key::state was added to query the three states that a key can
    be in: uninitialized, valid, or destroyed. This function, and the
    corresponding State enum, are both marked unstable as we may wish to expand
    it later on.
  • thread_local::scoped is entirely unstable. There hasn't been a whole lot of
    usage of this module in the standard distribution, so it remains unstable at
    this time.

Note that while the structure Key is marked stable, it is currently forced to
expose all of its implementation details due to the use of
construction-via-macro. The use of construction-via-macro is currently required
in order to place the #[thread_local] attribute on static in a
platform-specific manner. These stability attributes were assigned assuming that
it will be acceptable to tweak the implementation of Key in the future.

@rust-highfive
Copy link
Collaborator

r? @huonw

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton
Copy link
Member Author

r? @aturon

This commit performs a second pass over the `std::thread_local` module. Most of
the functionality remains explicitly unstable, but the specific actions taken
were:

* `thread_local` is now stable
* `thread_local!` is now stable
* `thread_local::Key` is now stable
* `thread_local::Key::with` is now stable
* `thread_local::Key::destroyed` is deprecated in favor of a more general
  `state` function
* `thread_local::Key::state` was added to query the three states that a key can
  be in: uninitialized, valid, or destroyed. This function, and the
  corresponding `State` enum, are both marked unstable as we may wish to expand
  it later on.
* `thread_local::scoped` is entirely unstable. There hasn't been a whole lot of
  usage of this module in the standard distribution, so it remains unstable at
  this time.

Note that while the structure `Key` is marked stable, it is currently forced to
expose all of its implementation details due to the use of
construction-via-macro. The use of construction-via-macro is currently required
in order to place the `#[thread_local]` attribute on static in a
platform-specific manner. These stability attributes were assigned assuming that
it will be acceptable to tweak the implementation of `Key` in the future.
@alexcrichton alexcrichton force-pushed the second-pass-thread_local branch from 1a7769f to be11aa6 Compare December 31, 2014 23:51
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Jan 2, 2015
Conflicts:
	src/libstd/sys/common/thread_info.rs
@bors bors merged commit be11aa6 into rust-lang:master Jan 2, 2015
@alexcrichton alexcrichton deleted the second-pass-thread_local branch January 3, 2015 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants