Skip to content

Commit

Permalink
Disallow thread_local in the C++11 style guide.
Browse files Browse the repository at this point in the history
This rule is based on the threads linked in the update.

Change-Id: I8a9ea24fd16598abcf21e7afc2533bcb0e7c411e
Reviewed-on: https://chromium-review.googlesource.com/617064
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Commit-Queue: Brett Wilson <brettw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#496396}
  • Loading branch information
Brett Wilson authored and Commit Bot committed Aug 22, 2017
1 parent c880b49 commit 251bf4f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions styleguide/c++/c++11.html
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,14 @@ <h3 id="blacklist_banned"><a name="core-blacklist"></a>C++11 Banned Features</h3
<td>Banned in the <a href="https://google.github.io/styleguide/cppguide.html#Operator_Overloading">Google Style Guide</a>.</td>
</tr>

<tr>
<td>thread_local storage class</td>
<td><code>thread_local int foo = 1;</code></td>
<td>Puts variables into thread local storage.</td>
<td><a href="http://en.cppreference.com/w/cpp/language/storage_duration">Storage duration</a></td>
<td>Some surprising effects on Mac (<a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/2msN8k3Xzgs">discussion</a>, <a href="https://groups.google.com/a/chromium.org/forum/#!topic/cxx/h7O5BdtWCZw">fork</a>). Use <a href="https://cs.chromium.org/chromium/src/base/threading/sequence_local_storage_slot.h">SequenceLocalStorageSlot</a> for sequence support, and <a href="https://cs.chromium.org/chromium/src/base/threading/thread_local.h">ThreadLocal</a>/<a href="https://cs.chromium.org/chromium/src/base/threading/thread_local_storage.h">ThreadLocalStorage</a> otherwise.</td>
</tr>

</tbody>
</table>

Expand Down

0 comments on commit 251bf4f

Please sign in to comment.