px4_sem: use px4_sem on all POSIX system

This uses the "fake" px4_sem based on mutex and condition_variable on
all POSIX system, not just macOS and Cygwin. This means that we can
change px4_sem_timedwait under the hood and inject the simulated time.
This commit is contained in:
Julian Oes 2018-10-15 15:02:03 +02:00
parent 3e6e1f5c2b
commit 98ae0186e9
2 changed files with 4 additions and 3 deletions

View File

@ -40,12 +40,13 @@
#include <px4_defines.h>
#include <px4_middleware.h>
#include <px4_workqueue.h>
#include <px4_time.h>
#include <stdint.h>
#include <stdio.h>
#include <pthread.h>
#include <errno.h>
#if defined(__PX4_DARWIN) || defined(__PX4_CYGWIN)
#if defined(__PX4_DARWIN) || defined(__PX4_CYGWIN) || defined(__PX4_POSIX)
#include <px4_posix.h>
@ -132,7 +133,7 @@ int px4_sem_timedwait(px4_sem_t *s, const struct timespec *abstime)
int err = ret;
if (err != 0 && err != ETIMEDOUT) {
if (err != 0 && errno != ETIMEDOUT) {
setbuf(stdout, NULL);
setbuf(stderr, NULL);
const unsigned NAMELEN = 32;

View File

@ -50,7 +50,7 @@
#define sem_setprotocol(s,p)
#endif
#if defined(__PX4_DARWIN) || defined(__PX4_CYGWIN)
#if defined(__PX4_DARWIN) || defined(__PX4_CYGWIN) || defined(__PX4_POSIX)
__BEGIN_DECLS