Skip to content

Commit

Permalink
uORB cleanup: change cb_triggered to simple boolean
Browse files Browse the repository at this point in the history
It is either set or not, there is no point in having a counter

Signed-off-by: Jukka Laitinen <[email protected]>
  • Loading branch information
jlaitine committed Dec 12, 2023
1 parent 2f7ca3b commit 1fb979f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions platforms/common/uORB/uORBDeviceNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ uORB::DeviceNode::write(const char *buffer, const orb_metadata *meta, orb_advert

// Release poll waiters and callback threads
if (Manager::isThreadAlive(item->lock)) {
__atomic_fetch_add(&item->cb_triggered, 1, __ATOMIC_SEQ_CST);
item->cb_triggered = true;
Manager::unlockThread(item->lock);

} else {
Expand Down Expand Up @@ -889,7 +889,7 @@ uORB::DeviceNode::_register_callback(uORB::SubscriptionCallback *cb_sub,
#ifdef CONFIG_BUILD_FLAT
item->subscriber = cb_sub;
#else
item->cb_triggered = 0;
item->cb_triggered = false;
#endif
item->last_update = last_update;
item->interval_us = interval_us;
Expand Down
6 changes: 3 additions & 3 deletions platforms/common/uORB/uORBDeviceNode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ class DeviceNode
#ifndef CONFIG_BUILD_FLAT
int8_t ret = -1;

if (__atomic_load_n(&item->cb_triggered, __ATOMIC_SEQ_CST) > 0) {
__atomic_fetch_sub(&item->cb_triggered, 1, __ATOMIC_SEQ_CST);
if (item->cb_triggered) {
item->cb_triggered = false;
ret = item->lock;
}

Expand All @@ -271,7 +271,7 @@ class DeviceNode
#ifdef CONFIG_BUILD_FLAT
class SubscriptionCallback *subscriber;
#else
unsigned cb_triggered;
bool cb_triggered;
#endif
hrt_abstime last_update;
uint32_t interval_us;
Expand Down

0 comments on commit 1fb979f

Please sign in to comment.