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:
Beat Küng 2016-04-26 09:32:04 +02:00 committed by Lorenz Meier
parent 44012be8b6
commit c6da90ac63
1 changed files with 4 additions and 3 deletions

View File

@ -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;
}