Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
TrentHouliston committed Oct 26, 2024
1 parent 23b98f1 commit 8ca3604
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/dsl/word/TaskScope.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,8 @@ namespace dsl {
Lock& operator=(const Lock&) = delete;

// Moving the lock must invalidate the old lock
Lock(Lock&& other) noexcept {
valid = std::exchange(other.valid, false);
old_id = other.old_id;
}
Lock& operator=(Lock&& other) {
Lock(Lock&& other) noexcept : valid(std::exchange(other.valid, false)), old_id(other.old_id) {}
Lock& operator=(Lock&& other) noexcept {
if (this != &other) {
valid = std::exchange(other.valid, false);
old_id = other.old_id;
Expand Down Expand Up @@ -88,19 +85,20 @@ namespace dsl {

static bool in_scope() {
// Get the current task id
auto* task = threading::ReactionTask::get_current_task();
const auto* task = threading::ReactionTask::get_current_task();

// Check if the current task id is the word
return task != nullptr && task->id == current_task_id;
}

private:
/// The current task id that is running
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
static ATTRIBUTE_TLS NUClear::id_t current_task_id;
};

// Initialise the current task id
template <typename Group>
template <typename Group> // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
ATTRIBUTE_TLS NUClear::id_t TaskScope<Group>::current_task_id{0};

} // namespace word
Expand Down

0 comments on commit 8ca3604

Please sign in to comment.