Changeset b5bfaaf9 in rtems


Ignore:
Timestamp:
Jun 23, 2016, 8:55:38 PM (3 years ago)
Author:
Gedare Bloom <gedare@…>
Branches:
master
Children:
e0f17fc
Parents:
127c20e
git-author:
Gedare Bloom <gedare@…> (06/23/16 20:55:38)
git-committer:
Gedare Bloom <gedare@…> (07/25/16 16:44:47)
Message:

posix: cond_timedwait remember and use clock from condattr

updates #2745

Location:
cpukit
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • cpukit/posix/include/rtems/posix/cond.h

    r127c20e rb5bfaaf9  
    4545   Thread_queue_Control  Wait_queue;
    4646   pthread_mutex_t       mutex;
     47   clockid_t             clock;
    4748}  POSIX_Condition_variables_Control;
    4849
  • cpukit/posix/include/rtems/posix/condimpl.h

    r127c20e rb5bfaaf9  
    4848
    4949RTEMS_INLINE_ROUTINE void _POSIX_Condition_variables_Initialize(
    50   POSIX_Condition_variables_Control *the_cond
     50  POSIX_Condition_variables_Control *the_cond,
     51  pthread_condattr_t *the_attr
    5152)
    5253{
    5354  _Thread_queue_Initialize( &the_cond->Wait_queue );
    5455  the_cond->mutex = POSIX_CONDITION_VARIABLES_NO_MUTEX;
     56  the_cond->clock = the_attr->clock;
    5557}
    5658
  • cpukit/posix/src/condinit.c

    r127c20e rb5bfaaf9  
    5252  }
    5353
    54   _POSIX_Condition_variables_Initialize( the_cond );
     54  _POSIX_Condition_variables_Initialize( the_cond, the_attr );
    5555
    5656  _Objects_Open_u32(
  • cpukit/posix/src/condtimedwait.c

    r127c20e rb5bfaaf9  
    3232)
    3333{
     34  if ( abstime == NULL ) {
     35    return EINVAL; /* not specified */
     36  }
    3437  return _POSIX_Condition_variables_Wait_support(
    3538    cond,
  • cpukit/posix/src/condwaitsupp.c

    r127c20e rb5bfaaf9  
    6666     *  status into the appropriate error.
    6767     */
    68     status = _TOD_Absolute_timeout_to_ticks( abstime, &timeout );
     68    _Assert( the_cond->clock );
     69    status = _TOD_Absolute_timeout_to_ticks(abstime, the_cond->clock, &timeout);
    6970    if ( status == TOD_ABSOLUTE_TIMEOUT_INVALID )
    7071      return EINVAL;
  • cpukit/posix/src/mqueuetimedreceive.c

    r127c20e rb5bfaaf9  
    7777   *  then we should not wait.
    7878   */
    79   status = _TOD_Absolute_timeout_to_ticks( abstime, &ticks );
     79  status = _TOD_Absolute_timeout_to_ticks( abstime, CLOCK_REALTIME, &ticks );
    8080  if ( status != TOD_ABSOLUTE_TIMEOUT_IS_IN_FUTURE )
    8181    do_wait = false;
  • cpukit/posix/src/mqueuetimedsend.c

    r127c20e rb5bfaaf9  
    5757   *  then we should not wait.
    5858   */
    59   status = _TOD_Absolute_timeout_to_ticks( abstime, &ticks );
     59  status = _TOD_Absolute_timeout_to_ticks( abstime, CLOCK_REALTIME, &ticks );
    6060  if ( status != TOD_ABSOLUTE_TIMEOUT_IS_IN_FUTURE )
    6161    do_wait = false;
  • cpukit/posix/src/mutextimedlock.c

    r127c20e rb5bfaaf9  
    5656   *  then we should not wait.
    5757   */
    58   status = _TOD_Absolute_timeout_to_ticks( abstime, &ticks );
     58  status = _TOD_Absolute_timeout_to_ticks( abstime, CLOCK_REALTIME, &ticks );
    5959  if ( status != TOD_ABSOLUTE_TIMEOUT_IS_IN_FUTURE )
    6060    do_wait = false;
  • cpukit/posix/src/prwlocktimedrdlock.c

    r127c20e rb5bfaaf9  
    4848   *  then we should not wait.
    4949   */
    50   timeout_status = _TOD_Absolute_timeout_to_ticks( abstime, &ticks );
     50  timeout_status = _TOD_Absolute_timeout_to_ticks( abstime, CLOCK_REALTIME, &ticks );
    5151  do_wait = ( timeout_status == TOD_ABSOLUTE_TIMEOUT_IS_IN_FUTURE );
    5252
  • cpukit/posix/src/prwlocktimedwrlock.c

    r127c20e rb5bfaaf9  
    5050   *  then we should not wait.
    5151   */
    52   timeout_status = _TOD_Absolute_timeout_to_ticks( abstime, &ticks );
     52  timeout_status = _TOD_Absolute_timeout_to_ticks( abstime, CLOCK_REALTIME, &ticks );
    5353  do_wait = ( timeout_status == TOD_ABSOLUTE_TIMEOUT_IS_IN_FUTURE );
    5454
  • cpukit/posix/src/semtimedwait.c

    r127c20e rb5bfaaf9  
    6161   *  then we should not wait.
    6262   */
    63   status = _TOD_Absolute_timeout_to_ticks( abstime, &ticks );
     63  status = _TOD_Absolute_timeout_to_ticks( abstime, CLOCK_REALTIME, &ticks );
    6464  if ( status != TOD_ABSOLUTE_TIMEOUT_IS_IN_FUTURE )
    6565    do_wait = false;
  • cpukit/score/include/rtems/score/todimpl.h

    r127c20e rb5bfaaf9  
    364364 *
    365365 * @param[in] abstime is a pointer to the timeout
     366 * @param[in] clock is the time source to use for the timeout
    366367 * @param[out] ticks_out will contain the number of ticks
    367368 *
     
    373374TOD_Absolute_timeout_conversion_results _TOD_Absolute_timeout_to_ticks(
    374375  const struct timespec *abstime,
     376  clockid_t              clock,
    375377  Watchdog_Interval     *ticks_out
    376378);
  • cpukit/score/src/condition.c

    r127c20e rb5bfaaf9  
    142142  _ISR_lock_ISR_disable( &queue_context.Lock_context );
    143143
    144   switch ( _TOD_Absolute_timeout_to_ticks( abstime, &ticks ) ) {
     144  switch ( _TOD_Absolute_timeout_to_ticks( abstime, CLOCK_REALTIME, &ticks ) ) {
    145145    case TOD_ABSOLUTE_TIMEOUT_INVALID:
    146146      _ISR_lock_ISR_enable( &queue_context.Lock_context );
     
    204204  _ISR_lock_ISR_disable( &queue_context.Lock_context );
    205205
    206   switch ( _TOD_Absolute_timeout_to_ticks( abstime, &ticks ) ) {
     206  switch ( _TOD_Absolute_timeout_to_ticks( abstime, CLOCK_REALTIME, &ticks ) ) {
    207207    case TOD_ABSOLUTE_TIMEOUT_INVALID:
    208208      _ISR_lock_ISR_enable( &queue_context.Lock_context );
  • cpukit/score/src/coretodabsolutetimeout.c

    r127c20e rb5bfaaf9  
    2626TOD_Absolute_timeout_conversion_results _TOD_Absolute_timeout_to_ticks(
    2727  const struct timespec *abstime,
     28  clockid_t              clock,
    2829  Watchdog_Interval     *ticks_out
    2930)
     
    3132  struct timespec current_time;
    3233  struct timespec difference;
    33 
    3434
    3535  /*
     
    4747   *  Is the absolute time in the past?
    4848   */
    49   _TOD_Get_as_timespec( &current_time );
     49  if ( clock == CLOCK_REALTIME ) {
     50    _TOD_Get_as_timespec( &current_time );
     51  } else {
     52    _Assert( clock == CLOCK_MONOTONIC );
     53    _TOD_Get_zero_based_uptime_as_timespec( &current_time );
     54  }
    5055
    5156  if ( _Timespec_Less_than( abstime, &current_time ) )
  • cpukit/score/src/mutex.c

    r127c20e rb5bfaaf9  
    248248    Watchdog_Interval ticks;
    249249
    250     switch ( _TOD_Absolute_timeout_to_ticks( abstime, &ticks ) ) {
     250    switch ( _TOD_Absolute_timeout_to_ticks( abstime, CLOCK_REALTIME, &ticks ) ) {
    251251      case TOD_ABSOLUTE_TIMEOUT_INVALID:
    252252        _Mutex_Queue_release( mutex, &queue_context );
     
    372372    Watchdog_Interval ticks;
    373373
    374     switch ( _TOD_Absolute_timeout_to_ticks( abstime, &ticks ) ) {
     374    switch ( _TOD_Absolute_timeout_to_ticks( abstime, CLOCK_REALTIME, &ticks ) ) {
    375375      case TOD_ABSOLUTE_TIMEOUT_INVALID:
    376376        _Mutex_Queue_release( &mutex->Mutex, &queue_context );
Note: See TracChangeset for help on using the changeset viewer.