Device:: Move to POSIX semaphore abstraction

This commit is contained in:
Lorenz Meier
2015-09-20 00:27:41 +02:00
parent d73deabf5c
commit 76508ab5b5
5 changed files with 22 additions and 38 deletions
+5 -4
View File
@@ -366,7 +366,7 @@ VDev::poll(file_t *filep, px4_pollfd_struct_t *fds, bool setup)
/* yes? post the notification */
if (fds->revents != 0)
sem_post(fds->sem);
px4_sem_post(fds->sem);
} else {
PX4_WARN("Store Poll Waiter error.");
}
@@ -403,7 +403,7 @@ VDev::poll_notify_one(px4_pollfd_struct_t *fds, pollevent_t events)
{
PX4_DEBUG("VDev::poll_notify_one");
int value;
sem_getvalue(fds->sem, &value);
px4_sem_getvalue(fds->sem, &value);
/* update the reported event set */
fds->revents |= fds->events & events;
@@ -412,8 +412,9 @@ VDev::poll_notify_one(px4_pollfd_struct_t *fds, pollevent_t events)
/* if the state is now interesting, wake the waiter if it's still asleep */
/* XXX semcount check here is a vile hack; counting semphores should not be abused as cvars */
if ((fds->revents != 0) && (value <= 0))
sem_post(fds->sem);
if ((fds->revents != 0) && (value <= 0)) {
px4_sem_post(fds->sem);
}
}
pollevent_t