diff --git a/include/realtime_tools/realtime_publisher.h b/include/realtime_tools/realtime_publisher.h index 6b726f72..c720c403 100644 --- a/include/realtime_tools/realtime_publisher.h +++ b/include/realtime_tools/realtime_publisher.h @@ -121,10 +121,7 @@ class RealtimePublisher void unlockAndPublish() { turn_ = NON_REALTIME; - msg_mutex_.unlock(); -#ifdef NON_POLLING - updated_cond_.notify_one(); -#endif + unlock(); } /** \brief Get the data lock form non-realtime @@ -148,7 +145,13 @@ class RealtimePublisher /** \brief Unlocks the data without publishing anything * */ - void unlock() { msg_mutex_.unlock(); } + void unlock() + { + msg_mutex_.unlock(); +#ifdef NON_POLLING + updated_cond_.notify_one(); +#endif + } private: // non-copyable