Changeset a1bfb33 in rtems


Ignore:
Timestamp:
Sep 1, 2011, 6:24:57 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10
Children:
84019c5
Parents:
bebd1012
Message:

2011-09-01 Joel Sherrill <joel.sherrilL@…>

PR 1895/cpukit

  • posix/src/mqueuerecvsupp.c, posix/src/pthreadjoin.c, score/src/coretodmsecstoticks.c, score/src/coretodusectoticks.c, score/src/timespectoticks.c: Ensure time conversions to ticks do not ignore partial tick and return 1 less than desired.
Location:
cpukit
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    rbebd1012 ra1bfb33  
     12011-09-01      Joel Sherrill <joel.sherrilL@OARcorp.com>
     2
     3        PR 1895/cpukit
     4        * posix/src/mqueuerecvsupp.c, posix/src/pthreadjoin.c,
     5        score/src/coretodmsecstoticks.c, score/src/coretodusectoticks.c,
     6        score/src/timespectoticks.c: Ensure time conversions to ticks do not
     7        ignore partial tick and return 1 less than desired.
     8
    192011-07-31      Joel Sherrill <joel.sherrilL@OARcorp.com>
    210
  • cpukit/posix/src/mqueuerecvsupp.c

    rbebd1012 ra1bfb33  
    1212 *         time.
    1313 *
    14  *  COPYRIGHT (c) 1989-2008.
     14 *  COPYRIGHT (c) 1989-2011.
    1515 *  On-Line Applications Research Corporation (OAR).
    1616 *
     
    106106
    107107      _Thread_Enable_dispatch();
    108       *msg_prio =
    109         _POSIX_Message_queue_Priority_from_core(_Thread_Executing->Wait.count);
     108      if (msg_prio) {
     109        *msg_prio = _POSIX_Message_queue_Priority_from_core(
     110             _Thread_Executing->Wait.count
     111          );
     112      }
    110113
    111114      if ( !_Thread_Executing->Wait.return_code )
  • cpukit/posix/src/pthreadjoin.c

    rbebd1012 ra1bfb33  
    5656      if ( the_thread->current_state ==
    5757             (STATES_WAITING_FOR_JOIN_AT_EXIT | STATES_TRANSIENT) ) {
    58          return_pointer = the_thread->Wait.return_argument;
    59          _Thread_Clear_state(
    60            the_thread,
    61            (STATES_WAITING_FOR_JOIN_AT_EXIT | STATES_TRANSIENT)
    62          );
     58        return_pointer = the_thread->Wait.return_argument;
     59        _Thread_Clear_state(
     60          the_thread,
     61          (STATES_WAITING_FOR_JOIN_AT_EXIT | STATES_TRANSIENT)
     62        );
     63        _Thread_Enable_dispatch();
    6364      } else {
    64         _Thread_Executing->Wait.return_argument = &return_pointer;
     65        _Thread_Executing->Wait.return_argument = &return_pointer;
    6566        _Thread_queue_Enter_critical_section( &api->Join_List );
    6667        _Thread_queue_Enqueue( &api->Join_List, WATCHDOG_NO_TIMEOUT );
     68        _Thread_Enable_dispatch();
     69
     70        if ( _Thread_Executing->Wait.return_code == EINTR )
     71          goto on_EINTR;
    6772      }
    68       _Thread_Enable_dispatch();
    69 
    70       if ( _Thread_Executing->Wait.return_code == EINTR )
    71         goto on_EINTR;
    7273
    7374      if ( value_ptr )
  • cpukit/score/src/coretodmsecstoticks.c

    rbebd1012 ra1bfb33  
    1 /*  COPYRIGHT (c) 1989-2008.
     1/*  COPYRIGHT (c) 1989-2011.
    22 *  On-Line Applications Research Corporation (OAR).
    33 *
     
    2222)
    2323{
    24   return (milliseconds / rtems_configuration_get_milliseconds_per_tick());
     24  uint32_t ticks;
     25  uint32_t milliseconds_per_tick;
     26
     27  /**
     28   *  We should ensure the ticks not be truncated by integer division.  We
     29   *  need to have it be greater than or equal to the requested time.  It
     30   *  should not be shorter.
     31   */
     32  milliseconds_per_tick = rtems_configuration_get_milliseconds_per_tick();
     33  ticks                 = milliseconds / milliseconds_per_tick;
     34  if ( (milliseconds % milliseconds_per_tick) != 0 )
     35    ticks += 1;
     36
     37  return ticks;
    2538}
  • cpukit/score/src/coretodusectoticks.c

    rbebd1012 ra1bfb33  
    1 /*  COPYRIGHT (c) 1989-2008.
     1/*  COPYRIGHT (c) 1989-2011.
    22 *  On-Line Applications Research Corporation (OAR).
    33 *
     
    2222)
    2323{
    24   return (microseconds / rtems_configuration_get_microseconds_per_tick());
     24  uint32_t ticks;
     25  uint32_t microseconds_per_tick;
     26
     27  /**
     28   *  We should ensure the ticks not be truncated by integer division.  We
     29   *  need to have it be greater than or equal to the requested time.  It
     30   *  should not be shorter.
     31   */
     32  microseconds_per_tick = rtems_configuration_get_microseconds_per_tick();
     33  ticks                 = microseconds / microseconds_per_tick;
     34  if ( (microseconds % microseconds_per_tick) != 0 )
     35    ticks += 1;
     36
     37  return ticks;
    2538}
  • cpukit/score/src/timespectoticks.c

    rbebd1012 ra1bfb33  
    3636{
    3737  uint32_t  ticks;
     38  uint32_t  nanoseconds_per_tick;
    3839
    3940  if ( (time->tv_sec == 0) && (time->tv_nsec == 0) )
    4041    return 0;
    4142
    42   ticks  = time->tv_sec * TOD_TICKS_PER_SECOND;
     43  /**
     44   *  We should ensure the ticks not be truncated by integer division.  We
     45   *  need to have it be greater than or equal to the requested time.  It
     46   *  should not be shorter.
     47   */
     48  ticks                 = time->tv_sec * TOD_TICKS_PER_SECOND;
     49  nanoseconds_per_tick  = rtems_configuration_get_nanoseconds_per_tick();
     50  ticks                += time->tv_nsec / nanoseconds_per_tick;
    4351
    44   ticks += time->tv_nsec / rtems_configuration_get_nanoseconds_per_tick();
     52  if ( (time->tv_nsec % nanoseconds_per_tick) != 0 )
     53    ticks += 1;
    4554
    46   if (ticks)
    47     return ticks;
    48 
    49   return 1;
     55  return ticks;
    5056}
Note: See TracChangeset for help on using the changeset viewer.