Added missing lock() unlock() to MuORB

The commented out lock and unlock were determined to be needed and added back.

The unit test for VDev was updated. It showed the race between the poll and a
write that only does a poll_notify().

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
Mark Charlebois
2015-04-29 17:04:30 -07:00
parent b408983d4c
commit a209fdc8ef
2 changed files with 42 additions and 31 deletions
+2 -4
View File
@@ -310,8 +310,7 @@ ORBDevNode::read(device::file_t *filp, char *buffer, size_t buflen)
/*
* Perform an atomic copy & state update
*/
// FIXME - This used to disable interrupts
//lock();
lock();
/* if the caller doesn't want the data, don't give it to them */
if (nullptr != buffer)
@@ -329,7 +328,7 @@ ORBDevNode::read(device::file_t *filp, char *buffer, size_t buflen)
*/
sd->update_reported = false;
//unlock();
unlock();
return _meta->o_size;
}
@@ -366,7 +365,6 @@ ORBDevNode::write(device::file_t *filp, const char *buffer, size_t buflen)
return -EIO;
/* Perform an atomic copy. */
// FIXME - make sure lock is what we want here
lock();
memcpy(_data, buffer, _meta->o_size);
unlock();