summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src
diff options
context:
space:
mode:
authorGedare Bloom <gedare@rtems.org>2016-06-23 16:55:38 -0400
committerGedare Bloom <gedare@rtems.org>2016-07-25 12:44:47 -0400
commitb5bfaaf9c27996d672f7aad67fee24581ab2f218 (patch)
tree6504cee5972cd9003f5b36c58e4d94a020fde9fa /cpukit/score/src
parentposix: refactor cond wait support to defer abstime conversion (diff)
downloadrtems-b5bfaaf9c27996d672f7aad67fee24581ab2f218.tar.bz2
posix: cond_timedwait remember and use clock from condattr
updates #2745
Diffstat (limited to 'cpukit/score/src')
-rw-r--r--cpukit/score/src/condition.c4
-rw-r--r--cpukit/score/src/coretodabsolutetimeout.c9
-rw-r--r--cpukit/score/src/mutex.c4
3 files changed, 11 insertions, 6 deletions
diff --git a/cpukit/score/src/condition.c b/cpukit/score/src/condition.c
index 90717bc93e..b9e14adce8 100644
--- a/cpukit/score/src/condition.c
+++ b/cpukit/score/src/condition.c
@@ -141,7 +141,7 @@ int _Condition_Wait_timed(
_Thread_queue_Context_initialize( &queue_context );
_ISR_lock_ISR_disable( &queue_context.Lock_context );
- switch ( _TOD_Absolute_timeout_to_ticks( abstime, &ticks ) ) {
+ switch ( _TOD_Absolute_timeout_to_ticks( abstime, CLOCK_REALTIME, &ticks ) ) {
case TOD_ABSOLUTE_TIMEOUT_INVALID:
_ISR_lock_ISR_enable( &queue_context.Lock_context );
return EINVAL;
@@ -203,7 +203,7 @@ int _Condition_Wait_recursive_timed(
_Thread_queue_Context_initialize( &queue_context );
_ISR_lock_ISR_disable( &queue_context.Lock_context );
- switch ( _TOD_Absolute_timeout_to_ticks( abstime, &ticks ) ) {
+ switch ( _TOD_Absolute_timeout_to_ticks( abstime, CLOCK_REALTIME, &ticks ) ) {
case TOD_ABSOLUTE_TIMEOUT_INVALID:
_ISR_lock_ISR_enable( &queue_context.Lock_context );
return EINVAL;
diff --git a/cpukit/score/src/coretodabsolutetimeout.c b/cpukit/score/src/coretodabsolutetimeout.c
index 6c9ffc22d5..fe74a6bbf2 100644
--- a/cpukit/score/src/coretodabsolutetimeout.c
+++ b/cpukit/score/src/coretodabsolutetimeout.c
@@ -25,13 +25,13 @@
*/
TOD_Absolute_timeout_conversion_results _TOD_Absolute_timeout_to_ticks(
const struct timespec *abstime,
+ clockid_t clock,
Watchdog_Interval *ticks_out
)
{
struct timespec current_time;
struct timespec difference;
-
/*
* Make sure there is always a value returned.
*/
@@ -46,7 +46,12 @@ TOD_Absolute_timeout_conversion_results _TOD_Absolute_timeout_to_ticks(
/*
* Is the absolute time in the past?
*/
- _TOD_Get_as_timespec( &current_time );
+ if ( clock == CLOCK_REALTIME ) {
+ _TOD_Get_as_timespec( &current_time );
+ } else {
+ _Assert( clock == CLOCK_MONOTONIC );
+ _TOD_Get_zero_based_uptime_as_timespec( &current_time );
+ }
if ( _Timespec_Less_than( abstime, &current_time ) )
return TOD_ABSOLUTE_TIMEOUT_IS_IN_PAST;
diff --git a/cpukit/score/src/mutex.c b/cpukit/score/src/mutex.c
index ed600b3ec2..525992afe5 100644
--- a/cpukit/score/src/mutex.c
+++ b/cpukit/score/src/mutex.c
@@ -247,7 +247,7 @@ int _Mutex_Acquire_timed(
} else {
Watchdog_Interval ticks;
- switch ( _TOD_Absolute_timeout_to_ticks( abstime, &ticks ) ) {
+ switch ( _TOD_Absolute_timeout_to_ticks( abstime, CLOCK_REALTIME, &ticks ) ) {
case TOD_ABSOLUTE_TIMEOUT_INVALID:
_Mutex_Queue_release( mutex, &queue_context );
return EINVAL;
@@ -371,7 +371,7 @@ int _Mutex_recursive_Acquire_timed(
} else {
Watchdog_Interval ticks;
- switch ( _TOD_Absolute_timeout_to_ticks( abstime, &ticks ) ) {
+ switch ( _TOD_Absolute_timeout_to_ticks( abstime, CLOCK_REALTIME, &ticks ) ) {
case TOD_ABSOLUTE_TIMEOUT_INVALID:
_Mutex_Queue_release( &mutex->Mutex, &queue_context );
return EINVAL;