Skip to content

Commit 2fe825b

Browse files
author
iRobot ROS
authored
Merge pull request #59 from mauropasse/mauro/fix-deadlock
Unlock queue mutex after taking event
2 parents 02f4365 + b25bef8 commit 2fe825b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

rclcpp/include/rclcpp/experimental/buffers/events_queue.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class EventsQueue
115115
* @brief gets a single entity event from the queue
116116
* @return a single entity event
117117
*/
118-
// TODO: find an alternative to pop_all_events and
118+
// TODO(mauropasse): find an alternative to pop_all_events and
119119
// get_single_event to use standard queue interfaces
120120
RCLCPP_PUBLIC
121121
virtual

rclcpp/src/rclcpp/executors/events_executor.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ EventsExecutor::spin_some_impl(std::chrono::nanoseconds max_duration, bool exhau
141141
if (has_event) {
142142
ExecutorEvent event = events_queue_->front();
143143
events_queue_->pop();
144+
// Unlock the mutex, so if the execution of the event requires
145+
// pushing an event into the queue we avoid a deadlock.
146+
lock.unlock();
144147
this->execute_event(event);
145148
executed_events++;
146149
continue;

0 commit comments

Comments
 (0)