Changeset fc30ac5 in rtems


Ignore:
Timestamp:
Jun 13, 2016, 1:10:31 PM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
0c34dbf3
Parents:
23b1bb38
git-author:
Sebastian Huber <sebastian.huber@…> (06/13/16 13:10:31)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/13/16 13:19:50)
Message:

posix: Fix pthread_setschedparam()

Close #2735.

Files:
2 edited

Legend:

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

    r23b1bb38 rfc30ac5  
    113113    case SCHED_FIFO:
    114114    case SCHED_RR:
    115       _Thread_Set_priority( the_thread, new_priority, &unused, true );
     115      _Thread_Set_priority( the_thread, new_priority, &unused, false );
    116116      break;
    117117
  • testsuites/psxtests/psx05/init.c

    r23b1bb38 rfc30ac5  
    157157}
    158158
     159static void *counter_task(void *arg)
     160{
     161  int *counter;
     162
     163  counter = arg;
     164
     165  while ( *counter >= 0 ) {
     166    ++(*counter);
     167
     168    sched_yield();
     169  }
     170
     171  return counter;
     172}
     173
     174static void test_set_priority( void )
     175{
     176  int                 status;
     177  int                 policy;
     178  struct sched_param  param;
     179  pthread_t           thread;
     180  int                 counter;
     181  void               *exit_code;
     182
     183  counter = 0;
     184
     185  status = pthread_getschedparam( pthread_self(), &policy, &param );
     186  rtems_test_assert( status == 0 );
     187
     188  status = pthread_create( &thread, NULL, counter_task, &counter);
     189  rtems_test_assert( status == 0 );
     190
     191  ++param.sched_priority;
     192  status = pthread_setschedparam( pthread_self(), policy, &param );
     193  rtems_test_assert( status == 0 );
     194
     195  rtems_test_assert( counter == 0 );
     196
     197  --param.sched_priority;
     198  status = pthread_setschedparam( pthread_self(), policy, &param );
     199  rtems_test_assert( status == 0 );
     200
     201  rtems_test_assert( counter == 1 );
     202
     203  counter = -1;
     204  sched_yield();
     205
     206  status = pthread_join( thread, &exit_code );
     207  rtems_test_assert( status == 0 );
     208  rtems_test_assert( exit_code == &counter );
     209  rtems_test_assert( counter == -1 );
     210}
     211
    159212void *POSIX_Init(
    160213  void *argument
     
    179232
    180233  test_get_priority();
     234  test_set_priority();
    181235
    182236  /* set the time of day, and print our buffer in multiple ways */
Note: See TracChangeset for help on using the changeset viewer.