From 0e1b1cbb79804ac73c7e030eec6de996afe8f797 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 7 Apr 2024 21:35:52 -0500 Subject: [PATCH] Update: Add support for disable pthread mutex attr prioceiling for systems that do not support it. This is a follow up to the commit 66f43e90823f75ba7261de2abaf0e809b47a2c65. --- level_0/f_thread/c/thread.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/level_0/f_thread/c/thread.c b/level_0/f_thread/c/thread.c index 3edcb96..d042a33 100644 --- a/level_0/f_thread/c/thread.c +++ b/level_0/f_thread/c/thread.c @@ -1373,7 +1373,16 @@ extern "C" { } #endif // _di_f_thread_mutex_attribute_delete_ -#ifndef _di_f_thread_mutex_attribute_priority_ceiling_get_ +#if defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_attribute_priority_ceiling_get_) + f_status_t f_thread_mutex_attribute_priority_ceiling_get(const f_thread_mutex_attribute_t * const attribute, int * const ceiling) { + #ifndef _di_level_0_parameter_checking_ + if (!attribute) return F_status_set_error(F_parameter); + if (!ceiling) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return F_status_set_error(F_implement_not); + } +#elif !defined(_di_f_thread_mutex_attribute_priority_ceiling_get_) f_status_t f_thread_mutex_attribute_priority_ceiling_get(const f_thread_mutex_attribute_t * const attribute, int * const ceiling) { #ifndef _di_level_0_parameter_checking_ if (!attribute) return F_status_set_error(F_parameter); @@ -1391,9 +1400,17 @@ extern "C" { return F_okay; } -#endif // _di_f_thread_mutex_attribute_priority_ceiling_get_ +#endif // defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_attribute_priority_ceiling_get_) -#ifndef _di_f_thread_mutex_attribute_priority_ceiling_set_ +#if defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_attribute_priority_ceiling_set_) + f_status_t f_thread_mutex_attribute_priority_ceiling_set(const int ceiling, f_thread_mutex_attribute_t * const attribute) { + #ifndef _di_level_0_parameter_checking_ + if (!attribute) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + return F_status_set_error(F_implement_not); + } +#elif !defined(_di_f_thread_mutex_attribute_priority_ceiling_set_) f_status_t f_thread_mutex_attribute_priority_ceiling_set(const int ceiling, f_thread_mutex_attribute_t * const attribute) { #ifndef _di_level_0_parameter_checking_ if (!attribute) return F_status_set_error(F_parameter); @@ -1410,7 +1427,7 @@ extern "C" { return F_okay; } -#endif // _di_f_thread_mutex_attribute_priority_ceiling_set_ +#endif // defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_attribute_priority_ceiling_set_) #ifndef _di_f_thread_mutex_attribute_protocol_get_ f_status_t f_thread_mutex_attribute_protocol_get(const f_thread_mutex_attribute_t * const attribute, int * const protocol) { -- 1.8.3.1