commit | f39d0aed92a1257d6e12e244187db97959c0d8c4 | [log] [tgz] |
---|---|---|
author | Ewout van Bekkum <ewout@google.com> | Wed Dec 16 12:17:34 2020 -0800 |
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | Thu Dec 17 18:48:39 2020 +0000 |
tree | 5b60653b400ccc66720c75572cac89119f792ba4 | |
parent | 660ebba115629096f83c1559ac86b1749f23231c [diff] |
pw_sync_threadx: fix semaphore max value Fixes the semaphore max value constants for the ThreadX semaphore backends in case it is limited by the ptrdiff_t max value before the ThreadX token max value. Change-Id: Ifba6908395a3bbd41e6314adb8fe8d91d10ad062 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/27920 Commit-Queue: Ewout van Bekkum <ewout@google.com> Reviewed-by: Wyatt Hepler <hepler@google.com>
diff --git a/pw_sync_threadx/public/pw_sync_threadx/binary_semaphore_native.h b/pw_sync_threadx/public/pw_sync_threadx/binary_semaphore_native.h index e433435..cb4cb97 100644 --- a/pw_sync_threadx/public/pw_sync_threadx/binary_semaphore_native.h +++ b/pw_sync_threadx/public/pw_sync_threadx/binary_semaphore_native.h
@@ -23,6 +23,8 @@ using NativeBinarySemaphoreHandle = NativeBinarySemaphore&; inline constexpr ptrdiff_t kBinarySemaphoreMaxValue = - std::numeric_limits<ULONG>::max(); + std::numeric_limits<ptrdiff_t>::max() < std::numeric_limits<ULONG>::max() + ? std::numeric_limits<ptrdiff_t>::max() + : std::numeric_limits<ULONG>::max(); } // namespace pw::sync::backend
diff --git a/pw_sync_threadx/public/pw_sync_threadx/counting_semaphore_native.h b/pw_sync_threadx/public/pw_sync_threadx/counting_semaphore_native.h index d322a53..3db35a9 100644 --- a/pw_sync_threadx/public/pw_sync_threadx/counting_semaphore_native.h +++ b/pw_sync_threadx/public/pw_sync_threadx/counting_semaphore_native.h
@@ -23,6 +23,8 @@ using NativeCountingSemaphoreHandle = NativeCountingSemaphore&; inline constexpr ptrdiff_t kCountingSemaphoreMaxValue = - std::numeric_limits<ULONG>::max(); + std::numeric_limits<ptrdiff_t>::max() < std::numeric_limits<ULONG>::max() + ? std::numeric_limits<ptrdiff_t>::max() + : std::numeric_limits<ULONG>::max(); } // namespace pw::sync::backend