From c989f0ba698b04a06d9983366ecc0bed76385027 Mon Sep 17 00:00:00 2001 From: Pablo Romero Date: Thu, 2 Sep 2021 16:10:38 +0200 Subject: [PATCH] Improves support for Unix POSIX systems. [12392] (#2167) * Fixes #2164 STRICT_REALTIME for Unix POSIX systems. Signed-off-by: promero * Fixes #2166. Enable debug mode for Unix POSIX systems. Signed-off-by: promero --- include/fastrtps/utils/TimedConditionVariable.hpp | 10 +++++----- include/fastrtps/utils/TimedMutex.hpp | 2 +- src/cpp/rtps/reader/WriterProxy.cpp | 2 +- src/cpp/rtps/reader/WriterProxy.h | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/fastrtps/utils/TimedConditionVariable.hpp b/include/fastrtps/utils/TimedConditionVariable.hpp index ecacfa6ddc0..5887cfa66e9 100644 --- a/include/fastrtps/utils/TimedConditionVariable.hpp +++ b/include/fastrtps/utils/TimedConditionVariable.hpp @@ -37,9 +37,9 @@ #define CV_T_ _Cnd_t extern int clock_gettime(int, struct timespec* tv); - #elif HAVE_STRICT_REALTIME && defined(__linux__) + #elif HAVE_STRICT_REALTIME && defined(__unix__) */ -#if HAVE_STRICT_REALTIME && defined(__linux__) +#if HAVE_STRICT_REALTIME && defined(__unix__) #include #define CV_INIT_(x) pthread_cond_init(x, NULL); @@ -50,7 +50,7 @@ #define CV_T_ pthread_cond_t #else #include -#endif // if HAVE_STRICT_REALTIME && defined(__linux__) +#endif // if HAVE_STRICT_REALTIME && defined(__unix__) #include #include @@ -59,7 +59,7 @@ namespace eprosima { namespace fastrtps { -#if HAVE_STRICT_REALTIME && (/*defined(_WIN32) ||*/ defined(__linux__)) +#if HAVE_STRICT_REALTIME && (/*defined(_WIN32) ||*/ defined(__unix__)) class TimedConditionVariable { @@ -164,7 +164,7 @@ class TimedConditionVariable }; #else using TimedConditionVariable = std::condition_variable_any; -#endif // HAVE_STRICT_REALTIME && (/*defined(_WIN32)*/ || defined(__linux__)) +#endif // HAVE_STRICT_REALTIME && (/*defined(_WIN32)*/ || defined(__unix__)) } // namespace fastrtps } // namespace eprosima diff --git a/include/fastrtps/utils/TimedMutex.hpp b/include/fastrtps/utils/TimedMutex.hpp index e42398e7c79..b1982f56eaa 100644 --- a/include/fastrtps/utils/TimedMutex.hpp +++ b/include/fastrtps/utils/TimedMutex.hpp @@ -182,7 +182,7 @@ class RecursiveTimedMutex _Mtx_t mutex_; }; -#elif _GTHREAD_USE_MUTEX_TIMEDLOCK || !defined(__linux__) +#elif _GTHREAD_USE_MUTEX_TIMEDLOCK || !defined(__unix__) using TimedMutex = std::timed_mutex; using RecursiveTimedMutex = std::recursive_timed_mutex; #else diff --git a/src/cpp/rtps/reader/WriterProxy.cpp b/src/cpp/rtps/reader/WriterProxy.cpp index 13201314a74..499b59333c1 100644 --- a/src/cpp/rtps/reader/WriterProxy.cpp +++ b/src/cpp/rtps/reader/WriterProxy.cpp @@ -33,7 +33,7 @@ #include "rtps/RTPSDomainImpl.hpp" #include "utils/collections/node_size_helpers.hpp" -#if !defined(NDEBUG) && defined(FASTRTPS_SOURCE) && defined(__linux__) +#if !defined(NDEBUG) && defined(FASTRTPS_SOURCE) && defined(__unix__) #define SHOULD_DEBUG_LINUX #endif // SHOULD_DEBUG_LINUX diff --git a/src/cpp/rtps/reader/WriterProxy.h b/src/cpp/rtps/reader/WriterProxy.h index fc1454139a4..0b43e339e84 100644 --- a/src/cpp/rtps/reader/WriterProxy.h +++ b/src/cpp/rtps/reader/WriterProxy.h @@ -399,11 +399,11 @@ class WriterProxy : public RTPSMessageSenderInterface using ChangeIterator = decltype(changes_received_)::iterator; -#if !defined(NDEBUG) && defined(FASTRTPS_SOURCE) && defined(__linux__) +#if !defined(NDEBUG) && defined(FASTRTPS_SOURCE) && defined(__unix__) int get_mutex_owner() const; int get_thread_id() const; -#endif // if !defined(NDEBUG) && defined(FASTRTPS_SOURCE) && defined(__linux__) +#endif // if !defined(NDEBUG) && defined(FASTRTPS_SOURCE) && defined(__unix__) }; } /* namespace rtps */