Skip to content

Initialize all instances of std::atomic_bool #772

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

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/broken_sequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ActionTestNode : public ActionNode

private:
int time_;
std::atomic_bool stop_loop_;
std::atomic_bool stop_loop_ = false;
};

int main()
Expand Down
4 changes: 2 additions & 2 deletions include/behaviortree_cpp/action_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class ThreadedAction : public ActionNodeBase

private:
std::exception_ptr exptr_;
std::atomic_bool halt_requested_;
std::atomic_bool halt_requested_ = false;
std::future<void> thread_handle_;
std::mutex mutex_;
};
Expand Down Expand Up @@ -183,7 +183,7 @@ class StatefulActionNode : public ActionNodeBase
void halt() override final;

private:
std::atomic_bool halt_requested_;
std::atomic_bool halt_requested_ = false;
};

/**
Expand Down
2 changes: 1 addition & 1 deletion include/behaviortree_cpp/actions/sleep_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class SleepNode : public StatefulActionNode
TimerQueue<> timer_;
uint64_t timer_id_;

std::atomic_bool timer_waiting_;
std::atomic_bool timer_waiting_ = false;
std::mutex delay_mutex_;
};

Expand Down
2 changes: 1 addition & 1 deletion include/behaviortree_cpp/actions/test_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class TestNode : public BT::StatefulActionNode
TestNodeConfig _test_config;
ScriptFunction _executor;
TimerQueue<> _timer;
std::atomic_bool _completed;
std::atomic_bool _completed = false;
};

} // namespace BT
8 changes: 4 additions & 4 deletions include/behaviortree_cpp/decorators/delay_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ class DelayNode : public DecoratorNode

virtual BT::NodeStatus tick() override;

bool delay_started_;
std::atomic_bool delay_complete_;
bool delay_aborted_;
bool delay_started_ = false;
std::atomic_bool delay_complete_ = false;
bool delay_aborted_ = false;
unsigned msec_;
bool read_parameter_from_ports_;
bool read_parameter_from_ports_ = false;
std::mutex delay_mutex_;
};

Expand Down
2 changes: 1 addition & 1 deletion include/behaviortree_cpp/decorators/timeout_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class TimeoutNode : public DecoratorNode
void halt() override;

TimerQueue<> timer_;
std::atomic_bool child_halted_;
std::atomic_bool child_halted_ = false;
uint64_t timer_id_;

unsigned msec_;
Expand Down
2 changes: 1 addition & 1 deletion src/loggers/groot2_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ struct Groot2Publisher::PImpl

std::string tree_xml;

std::atomic_bool active_server;
std::atomic_bool active_server = false;
std::thread server_thread;

std::mutex status_mutex;
Expand Down