mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-15 07:00:35 +08:00
orb nuttx: fix threadding issue in uORB::DeviceNode::write
same issue as in posix code: 64bit values are not atomic in general.
This commit is contained in:
@@ -245,17 +245,18 @@ uORB::DeviceNode::write(struct file *filp, const char *buffer, size_t buflen)
|
||||
/* Perform an atomic copy. */
|
||||
irqstate_t flags = irqsave();
|
||||
memcpy(_data, buffer, _meta->o_size);
|
||||
irqrestore(flags);
|
||||
|
||||
/* update the timestamp and generation count */
|
||||
_last_update = hrt_absolute_time();
|
||||
_generation++;
|
||||
|
||||
_published = true;
|
||||
|
||||
irqrestore(flags);
|
||||
|
||||
/* notify any poll waiters */
|
||||
poll_notify(POLLIN);
|
||||
|
||||
_published = true;
|
||||
|
||||
return _meta->o_size;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user