File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323#ifndef NUCLEAR_DSL_STORE_THREADSTORE_HPP
2424#define NUCLEAR_DSL_STORE_THREADSTORE_HPP
2525
26- #include " ../../util/platform.hpp"
27-
2826namespace NUClear {
2927namespace dsl {
3028 namespace store {
@@ -46,12 +44,12 @@ namespace dsl {
4644 */
4745 template <typename DataType, int Index = 0 >
4846 struct ThreadStore {
49- static ATTRIBUTE_TLS DataType* value; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
47+ static thread_local DataType* value; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
5048 };
5149
5250 template <typename DataType, int index>
5351 // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
54- ATTRIBUTE_TLS DataType* ThreadStore<DataType, index>::value = nullptr ;
52+ thread_local DataType* ThreadStore<DataType, index>::value = nullptr ;
5553
5654 } // namespace store
5755} // namespace dsl
Original file line number Diff line number Diff line change 2424
2525#include " ../../id.hpp"
2626#include " ../../threading/ReactionTask.hpp"
27- #include " ../../util/platform.hpp"
2827
2928namespace NUClear {
3029namespace dsl {
@@ -93,12 +92,12 @@ namespace dsl {
9392 private:
9493 // / The current task id that is running
9594 // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
96- static ATTRIBUTE_TLS NUClear::id_t current_task_id;
95+ static thread_local NUClear::id_t current_task_id;
9796 };
9897
9998 // Initialise the current task id
10099 template <typename Group> // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
101- ATTRIBUTE_TLS NUClear::id_t TaskScope<Group>::current_task_id{0 };
100+ thread_local NUClear::id_t TaskScope<Group>::current_task_id{0 };
102101
103102 } // namespace word
104103} // namespace dsl
Original file line number Diff line number Diff line change 2929
3030#include " ../id.hpp"
3131#include " ../message/ReactionStatistics.hpp"
32- #include " ../util/platform.hpp"
3332#include " Reaction.hpp"
3433
3534namespace NUClear {
@@ -95,7 +94,7 @@ namespace threading {
9594
9695 // Initialize our current task
9796 // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
98- ATTRIBUTE_TLS ReactionTask* ReactionTask::current_task = nullptr ;
97+ thread_local ReactionTask* ReactionTask::current_task = nullptr ;
9998
10099} // namespace threading
101100} // namespace NUClear
Original file line number Diff line number Diff line change 3232#include " ../util/GroupDescriptor.hpp"
3333#include " ../util/Inline.hpp"
3434#include " ../util/ThreadPoolDescriptor.hpp"
35- #include " ../util/platform.hpp"
3635#include " Reaction.hpp"
3736
3837namespace NUClear {
@@ -53,7 +52,7 @@ namespace threading {
5352 class ReactionTask {
5453 private:
5554 // / The current task that is being executed by this thread (or nullptr if none is)
56- static ATTRIBUTE_TLS ReactionTask* current_task; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
55+ static thread_local ReactionTask* current_task; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
5756
5857 public:
5958 // / Type of the functions that ReactionTasks execute
Original file line number Diff line number Diff line change 3636#include " ../../message/ReactionStatistics.hpp"
3737#include " ../../threading/Reaction.hpp"
3838#include " ../../util/Inline.hpp"
39- #include " ../../util/platform.hpp"
4039#include " ../ReactionTask.hpp"
4140#include " CountingLock.hpp"
4241#include " Scheduler.hpp"
@@ -283,7 +282,7 @@ namespace threading {
283282
284283 // Initialise the current pool to nullptr if it is not already
285284 // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
286- ATTRIBUTE_TLS Pool* Pool::current_pool = nullptr ;
285+ thread_local Pool* Pool::current_pool = nullptr ;
287286
288287 } // namespace scheduler
289288} // namespace threading
Original file line number Diff line number Diff line change @@ -246,7 +246,7 @@ namespace threading {
246246 std::unique_ptr<Lock> pool_idle = nullptr ;
247247
248248 // / A thread local pointer to the current pool this thread is running in
249- static ATTRIBUTE_TLS Pool* current_pool; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
249+ static thread_local Pool* current_pool; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
250250
251251 friend class Scheduler ;
252252 };
You can’t perform that action at this time.
0 commit comments