Skip to content

Commit

Permalink
changed error message for single threaded spinner (#1164)
Browse files Browse the repository at this point in the history
* changed message to fatal stream and std::runtime_error message to be the same and not imply that spinning was successful when mixing single threaded spinner with multi/async spinners

* updated error messages to reflect behavior when calling a singlethreaded spinner alongside a multithreaded one

* changed position of whitespace
  • Loading branch information
jgueldenstein authored and dirk-thomas committed Dec 13, 2017
1 parent 97bb693 commit e9ae64a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions clients/roscpp/src/libros/spinner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ struct SpinnerMonitor

SpinnerMonitor spinner_monitor;
const std::string DEFAULT_ERROR_MESSAGE =
"Attempt to spin a callback queue from two spinners, one of them being single-threaded. "
"This will probably result in callbacks being executed out-of-order.";
"Attempt to spin a callback queue from two spinners, one of them being single-threaded.";
}

namespace ros
Expand All @@ -130,8 +129,9 @@ void SingleThreadedSpinner::spin(CallbackQueue* queue)

if (!spinner_monitor.add(queue, true))
{
ROS_FATAL_STREAM("SingleThreadedSpinner: " << DEFAULT_ERROR_MESSAGE);
throw std::runtime_error("There is already another spinner on this queue");
std::string errorMessage = "SingleThreadedSpinner: " + DEFAULT_ERROR_MESSAGE + " You might want to use a MultiThreadedSpinner instead.";
ROS_FATAL_STREAM(errorMessage);
throw std::runtime_error(errorMessage);
}

ros::WallDuration timeout(0.1f);
Expand Down Expand Up @@ -220,8 +220,9 @@ void AsyncSpinnerImpl::start()

if (!spinner_monitor.add(callback_queue_, false))
{
ROS_FATAL_STREAM("AsyncSpinnerImpl: " << DEFAULT_ERROR_MESSAGE);
throw std::runtime_error("There is already a single-threaded spinner on this queue");
std::string errorMessage = "AsyncSpinnerImpl: " + DEFAULT_ERROR_MESSAGE;
ROS_FATAL_STREAM(errorMessage);
throw std::runtime_error(errorMessage);
}

continue_ = true;
Expand Down

0 comments on commit e9ae64a

Please sign in to comment.