JDK-8230877 : Rename THREAD_LOCAL_DECL to THREAD_LOCAL
Type:Enhancement
Component:hotspot
Sub-Component:runtime
Affected Version:14
Priority:P4
Status:Resolved
Resolution:Fixed
Submitted:2019-09-11
Updated:2022-03-01
Resolved:2019-09-13
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
The initial description of this enhancement was:
---
ZGC uses thread locals in a number of places. It's currently using using the gcc specific __thread, but we'd like to make that compiler agnostic. We currently have the THREAD_LOCAL_DECL macro, which does what we want. However, I propose that we rename THREAD_LOCAL_DECL to thread_local, for the following reasons:
* In C+11, thread_local is standardized. When we upgrade to C++1X, we can just remove our own thread_local macros, without the need to touch any other code.
• The thread_local keyword is recognized by IDEs/editors, so gets correctly highlighted, etc.
• THREAD_LOCAL_DECL looks a bit clunky in declarations.
---
However, during review of the initial patch [~kbarrett] discovered that `thread_local` is not equivalent to `__thread` in GCC. As a result, we decided to only rename THREAD_LOCAL_DECL to THREAD_LOCAL, at least for now. For more details see the review thread here: https://mail.openjdk.java.net/pipermail/hotspot-dev/2019-September/039487.html