Changeset 64ba1a96 in rtems


Ignore:
Timestamp:
Nov 8, 2017, 2:29:14 PM (17 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
4a147518
Parents:
7147dc4
git-author:
Sebastian Huber <sebastian.huber@…> (11/08/17 14:29:14)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/09/17 07:12:11)
Message:

posix: Change created_with_explicit_scheduler

Remove POSIX_API_Control::created_with_explicit_scheduler. Add
Thread_Control::was_created_with_inherited_scheduler. This fixes also
pthread_getattr_np() for Classic tasks.

Update #2514.

Files:
5 edited

Legend:

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

    r7147dc4 r64ba1a96  
    4141 */
    4242typedef struct {
    43   /** Created with explicit or inherited scheduler. */
    44   bool created_with_explicit_scheduler;
    45 
    4643  /**
    4744   * @brief Control block for the sporadic server scheduling policy.
  • cpukit/posix/src/pthreadcreate.c

    r7147dc4 r64ba1a96  
    251251  api->signals_unblocked = executing_api->signals_unblocked;
    252252
    253   api->created_with_explicit_scheduler =
    254     ( the_attr->inheritsched == PTHREAD_EXPLICIT_SCHED );
     253  the_thread->was_created_with_inherited_scheduler =
     254    ( the_attr->inheritsched == PTHREAD_INHERIT_SCHED );
    255255
    256256  _Priority_Node_set_priority( &api->Sporadic.Low_priority, core_low_prio );
  • cpukit/posix/src/pthreadgetattrnp.c

    r7147dc4 r64ba1a96  
    6161  attr->stacksize = the_thread->Start.Initial_stack.size;
    6262
    63   if ( api->created_with_explicit_scheduler ) {
     63  if ( the_thread->was_created_with_inherited_scheduler ) {
     64    attr->inheritsched = PTHREAD_INHERIT_SCHED;
     65  } else {
    6466    attr->inheritsched = PTHREAD_EXPLICIT_SCHED;
    65   } else {
    66     attr->inheritsched = PTHREAD_INHERIT_SCHED;
    6767  }
    6868
  • cpukit/score/include/rtems/score/thread.h

    r7147dc4 r64ba1a96  
    774774  bool                                  is_fp;
    775775
     776  /**
     777   * @brief True, if the thread was created with an inherited scheduler
     778   * (PTHREAD_INHERIT_SCHED), and false otherwise.
     779   */
     780  bool was_created_with_inherited_scheduler;
     781
    776782  /** This field is the length of the time quantum that this thread is
    777783   *  allowed to consume.  The algorithm used to manage limits on CPU usage
  • testsuites/psxtests/psxclassic01/init.c

    r7147dc4 r64ba1a96  
    1818#endif
    1919
    20 #include "tmacros.h"
     20#define _GNU_SOURCE
    2121
    2222#include <stdio.h>
     
    2727#include <string.h>
    2828#include <sched.h>
     29#include <tmacros.h>
    2930
    3031const char rtems_test_name[] = "PSXCLASSIC 1";
     
    4950  struct sigaction new_action;
    5051  sigset_t mask;
    51   int policy;
     52  void *addr;
     53  size_t size;
     54  int value;
    5255  struct sched_param param;
     56  cpu_set_t set;
     57  pthread_attr_t attr;
    5358
    5459  printf("test_task starting...\n");
    5560
    56   policy = -1;
     61  value = -1;
    5762  memset( &param, -1, sizeof( param ) );
    58   sc = pthread_getschedparam( pthread_self(), &policy, &param );
    59   rtems_test_assert( sc == 0 );
    60   rtems_test_assert( policy == SCHED_FIFO );
     63  sc = pthread_getschedparam( pthread_self(), &value, &param );
     64  rtems_test_assert( sc == 0 );
     65  rtems_test_assert( value == SCHED_FIFO );
    6166  rtems_test_assert(
    6267    param.sched_priority == sched_get_priority_max( SCHED_FIFO )
    6368  );
    6469
    65   sc = pthread_setschedparam( pthread_self(), policy, &param );
     70  sc = pthread_setschedparam( pthread_self(), value, &param );
     71  rtems_test_assert( sc == 0 );
     72
     73  sc = pthread_getattr_np( pthread_self(), &attr );
     74  rtems_test_assert( sc == 0 );
     75
     76  addr = NULL;
     77  size = 0;
     78  sc = pthread_attr_getstack( &attr, &addr, &size );
     79  rtems_test_assert( sc == 0 );
     80  rtems_test_assert( addr != NULL );
     81  rtems_test_assert( size == RTEMS_MINIMUM_STACK_SIZE );
     82
     83  value = -1;
     84  sc = pthread_attr_getscope( &attr, &value );
     85  rtems_test_assert( sc == 0 );
     86  rtems_test_assert( value == PTHREAD_SCOPE_PROCESS );
     87
     88  value = -1;
     89  sc = pthread_attr_getinheritsched( &attr, &value );
     90  rtems_test_assert( sc == 0 );
     91  rtems_test_assert( value == PTHREAD_EXPLICIT_SCHED );
     92
     93  value = -1;
     94  sc = pthread_attr_getschedpolicy( &attr, &value );
     95  rtems_test_assert( sc == 0 );
     96  rtems_test_assert( value == SCHED_FIFO );
     97
     98  memset( &param, -1, sizeof( param ) );
     99  sc = pthread_attr_getschedparam( &attr, &param );
     100  rtems_test_assert( sc == 0 );
     101  rtems_test_assert(
     102    param.sched_priority == sched_get_priority_max( SCHED_FIFO )
     103  );
     104
     105  size = 1;
     106  sc = pthread_attr_getguardsize( &attr, &size );
     107  rtems_test_assert( sc == 0 );
     108  rtems_test_assert( size == 0 );
     109
     110  value = -1;
     111  sc = pthread_attr_getdetachstate( &attr, &value );
     112  rtems_test_assert( sc == 0 );
     113  rtems_test_assert( value == PTHREAD_CREATE_JOINABLE );
     114
     115  CPU_ZERO( &set );
     116  sc = pthread_attr_getaffinity_np( &attr, sizeof( set ), &set );
     117  rtems_test_assert( sc == 0 );
     118  rtems_test_assert( CPU_ISSET( 0, &set ) );
     119  rtems_test_assert( CPU_COUNT( &set ) == 1 );
     120
     121  sc = pthread_attr_destroy( &attr );
    66122  rtems_test_assert( sc == 0 );
    67123
Note: See TracChangeset for help on using the changeset viewer.