Skip to content

Commit 21ab495

Browse files
authored
Initialize std::atomic_bool (#772)
1 parent 8f9e52a commit 21ab495

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

examples/broken_sequence.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ActionTestNode : public ActionNode
3535

3636
private:
3737
int time_;
38-
std::atomic_bool stop_loop_;
38+
std::atomic_bool stop_loop_ = false;
3939
};
4040

4141
int main()

include/behaviortree_cpp/action_node.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class ThreadedAction : public ActionNodeBase
132132

133133
private:
134134
std::exception_ptr exptr_;
135-
std::atomic_bool halt_requested_;
135+
std::atomic_bool halt_requested_ = false;
136136
std::future<void> thread_handle_;
137137
std::mutex mutex_;
138138
};
@@ -183,7 +183,7 @@ class StatefulActionNode : public ActionNodeBase
183183
void halt() override final;
184184

185185
private:
186-
std::atomic_bool halt_requested_;
186+
std::atomic_bool halt_requested_ = false;
187187
};
188188

189189
/**

include/behaviortree_cpp/actions/sleep_node.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class SleepNode : public StatefulActionNode
3838
TimerQueue<> timer_;
3939
uint64_t timer_id_;
4040

41-
std::atomic_bool timer_waiting_;
41+
std::atomic_bool timer_waiting_ = false;
4242
std::mutex delay_mutex_;
4343
};
4444

include/behaviortree_cpp/actions/test_node.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class TestNode : public BT::StatefulActionNode
8888
TestNodeConfig _test_config;
8989
ScriptFunction _executor;
9090
TimerQueue<> _timer;
91-
std::atomic_bool _completed;
91+
std::atomic_bool _completed = false;
9292
};
9393

9494
} // namespace BT

include/behaviortree_cpp/decorators/delay_node.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ class DelayNode : public DecoratorNode
5656

5757
virtual BT::NodeStatus tick() override;
5858

59-
bool delay_started_;
60-
std::atomic_bool delay_complete_;
61-
bool delay_aborted_;
59+
bool delay_started_ = false;
60+
std::atomic_bool delay_complete_ = false;
61+
bool delay_aborted_ = false;
6262
unsigned msec_;
63-
bool read_parameter_from_ports_;
63+
bool read_parameter_from_ports_ = false;
6464
std::mutex delay_mutex_;
6565
};
6666

include/behaviortree_cpp/decorators/timeout_node.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class TimeoutNode : public DecoratorNode
7373
void halt() override;
7474

7575
TimerQueue<> timer_;
76-
std::atomic_bool child_halted_;
76+
std::atomic_bool child_halted_ = false;
7777
uint64_t timer_id_;
7878

7979
unsigned msec_;

src/loggers/groot2_publisher.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ struct Groot2Publisher::PImpl
7373

7474
std::string tree_xml;
7575

76-
std::atomic_bool active_server;
76+
std::atomic_bool active_server = false;
7777
std::thread server_thread;
7878

7979
std::mutex status_mutex;

0 commit comments

Comments
 (0)