diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-05-18 12:50:41 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-05-18 18:47:43 +0200 |
commit | a89ecaa1a94d49ddae7753d6b83923e9d2a00486 (patch) | |
tree | 2fccf3fd6b5a82f0415b497db190fbfa582a3866 /cpukit/include/rtems/score/watchdogimpl.h | |
parent | posix: Fix use of clock for relative times (diff) | |
download | rtems-a89ecaa1a94d49ddae7753d6b83923e9d2a00486.tar.bz2 |
score: Simplify thread queue timeout handling
Add Thread_queue_Context::timeout_absolute to specify an absolute or
relative timeout. This avoid having to get the current time twice for
timeouts relative to the current time. It moves also functionality to
common code.
Diffstat (limited to '')
-rw-r--r-- | cpukit/include/rtems/score/watchdogimpl.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cpukit/include/rtems/score/watchdogimpl.h b/cpukit/include/rtems/score/watchdogimpl.h index a8e6de4fbe..7b364b8828 100644 --- a/cpukit/include/rtems/score/watchdogimpl.h +++ b/cpukit/include/rtems/score/watchdogimpl.h @@ -535,6 +535,22 @@ RTEMS_INLINE_ROUTINE uint64_t _Watchdog_Ticks_from_timespec( } /** + * @brief Converts the ticks to timespec. + * + * @param ticks are the ticks to convert. + * + * @param[out] ts is the timespec to return the converted ticks. + */ +RTEMS_INLINE_ROUTINE void _Watchdog_Ticks_to_timespec( + uint64_t ticks, + struct timespec *ts +) +{ + ts->tv_sec = ticks >> WATCHDOG_BITS_FOR_1E9_NANOSECONDS; + ts->tv_nsec = ticks & ( ( 1U << WATCHDOG_BITS_FOR_1E9_NANOSECONDS ) - 1 ); +} + +/** * @brief Converts the sbintime in ticks. * * @param sbt The sbintime to convert to ticks. |