Changeset 23b1bb38 in rtems


Ignore:
Timestamp:
Jun 13, 2016, 4:53:27 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
fc30ac5
Parents:
a0cd238d
git-author:
Sebastian Huber <sebastian.huber@…> (06/13/16 04:53:27)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/13/16 12:56:21)
Message:

posix: Fix pthread_getschedparam()

Return the unmodified thread priority value according to POSIX.

Close #2736.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/posix/src/pthreadgetschedparam.c

    ra0cd238d r23b1bb38  
    5555  *param  = api->schedparam;
    5656  param->sched_priority = _POSIX_Priority_From_core(
    57     the_thread->current_priority
     57    the_thread->real_priority
    5858  );
    5959
  • testsuites/psxtests/psx05/init.c

    ra0cd238d r23b1bb38  
    113113}
    114114
     115static void test_get_priority( void )
     116{
     117  int                 status;
     118  pthread_mutexattr_t attr;
     119  pthread_mutex_t     mutex;
     120  int                 policy;
     121  struct sched_param  param;
     122  int                 real_priority;
     123
     124  status = pthread_getschedparam( pthread_self(), &policy, &param );
     125  rtems_test_assert( status == 0 );
     126
     127  real_priority = param.sched_priority;
     128
     129  status = pthread_mutexattr_init( &attr );
     130  rtems_test_assert( status == 0 );
     131
     132  status = pthread_mutexattr_setprotocol( &attr, PTHREAD_PRIO_PROTECT );
     133  rtems_test_assert( !status );
     134
     135  status = pthread_mutexattr_setprioceiling( &attr, real_priority + 1 );
     136  rtems_test_assert( status == 0 );
     137
     138  status = pthread_mutex_init( &mutex, &attr );
     139  rtems_test_assert( status == 0 );
     140
     141  status = pthread_mutexattr_destroy( &attr );
     142  rtems_test_assert( status == 0 );
     143
     144  status = pthread_mutex_lock( &mutex );
     145  rtems_test_assert( status == 0 );
     146
     147  status = pthread_getschedparam( pthread_self(), &policy, &param );
     148  rtems_test_assert( status == 0 );
     149
     150  rtems_test_assert( real_priority == param.sched_priority );
     151
     152  status = pthread_mutex_unlock( &mutex );
     153  rtems_test_assert( status == 0 );
     154
     155  status = pthread_mutex_destroy( &mutex );
     156  rtems_test_assert( status == 0 );
     157}
     158
    115159void *POSIX_Init(
    116160  void *argument
     
    134178  TEST_BEGIN();
    135179
     180  test_get_priority();
     181
    136182  /* set the time of day, and print our buffer in multiple ways */
    137183
Note: See TracChangeset for help on using the changeset viewer.