From ce67fee6b969bbff3a87f1f7fff354476203b35d Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Thu, 7 Dec 2023 21:32:07 -0500 Subject: [PATCH] uORB::DeviceNode mark advertised on write - this is a workaround if multiple publishers for the same topic exists and one unadvertises (eg uORB::Publication destruction) --- platforms/common/uORB/uORBDeviceNode.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/platforms/common/uORB/uORBDeviceNode.cpp b/platforms/common/uORB/uORBDeviceNode.cpp index 112170de6b..98debff0a4 100644 --- a/platforms/common/uORB/uORBDeviceNode.cpp +++ b/platforms/common/uORB/uORBDeviceNode.cpp @@ -219,14 +219,16 @@ uORB::DeviceNode::write(cdev::file_t *filp, const char *buffer, size_t buflen) memcpy(_data + (_meta->o_size * (generation % _queue_size)), buffer, _meta->o_size); + /* Mark at least one data has been published */ + _data_valid = true; + + mark_as_advertised(); + // callbacks for (auto item : _callbacks) { item->call(); } - /* Mark at least one data has been published */ - _data_valid = true; - ATOMIC_LEAVE; /* notify any poll waiters */