Skip to content

Commit

Permalink
Initialize std::atomic_bool (#772)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarqRazz authored Feb 13, 2024
1 parent 8f9e52a commit 21ab495
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
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

0 comments on commit 21ab495

Please sign in to comment.