mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-16 19:57:35 +08:00
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:
@@ -40,12 +40,13 @@
|
|||||||
#include <px4_defines.h>
|
#include <px4_defines.h>
|
||||||
#include <px4_middleware.h>
|
#include <px4_middleware.h>
|
||||||
#include <px4_workqueue.h>
|
#include <px4_workqueue.h>
|
||||||
|
#include <px4_time.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <errno.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>
|
#include <px4_posix.h>
|
||||||
|
|
||||||
@@ -132,7 +133,7 @@ int px4_sem_timedwait(px4_sem_t *s, const struct timespec *abstime)
|
|||||||
|
|
||||||
int err = ret;
|
int err = ret;
|
||||||
|
|
||||||
if (err != 0 && err != ETIMEDOUT) {
|
if (err != 0 && errno != ETIMEDOUT) {
|
||||||
setbuf(stdout, NULL);
|
setbuf(stdout, NULL);
|
||||||
setbuf(stderr, NULL);
|
setbuf(stderr, NULL);
|
||||||
const unsigned NAMELEN = 32;
|
const unsigned NAMELEN = 32;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
#define sem_setprotocol(s,p)
|
#define sem_setprotocol(s,p)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__PX4_DARWIN) || defined(__PX4_CYGWIN)
|
#if defined(__PX4_DARWIN) || defined(__PX4_CYGWIN) || defined(__PX4_POSIX)
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user