Changeset 4f9ed26 in rtems


Ignore:
Timestamp:
Oct 10, 2017, 5:13:37 AM (18 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
bd5be58f
Parents:
8c5267a
git-author:
Sebastian Huber <sebastian.huber@…> (10/10/17 05:13:37)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/10/17 05:17:51)
Message:

posix: Constify default thread processor affinity

Set default thread processor affinity to all processors of the
pre-allocated set. This allows to constify the
_POSIX_Threads_Default_attributes.

Update #2514.

Files:
4 edited

Legend:

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

    r8c5267a r4f9ed26  
    5252 * This variable contains the default POSIX Thread attributes.
    5353 */
    54 extern pthread_attr_t _POSIX_Threads_Default_attributes;
     54extern const pthread_attr_t _POSIX_Threads_Default_attributes;
    5555
    5656RTEMS_INLINE_ROUTINE void _POSIX_Threads_Sporadic_timer_insert(
  • cpukit/posix/src/pthread.c

    r8c5267a r4f9ed26  
    5050 *        _POSIX_Threads_Initialize_user_threads will need to be examined.
    5151 */
    52 pthread_attr_t _POSIX_Threads_Default_attributes = {
     52const pthread_attr_t _POSIX_Threads_Default_attributes = {
    5353  .is_initialized  = true,                       /* is_initialized */
    5454  .stackaddr       = NULL,                       /* stackaddr */
     
    8080  .affinityset             =
    8181    &_POSIX_Threads_Default_attributes.affinitysetpreallocated,
    82   .affinitysetpreallocated = {{0x1}}
     82  .affinitysetpreallocated = { { -1L } }
    8383};
    8484
     
    244244static void _POSIX_Threads_Manager_initialization(void)
    245245{
    246   #if defined(RTEMS_SMP)
    247     const CPU_set_Control *affinity;
    248     pthread_attr_t *attr;
    249 
    250     /* Initialize default attribute. */
    251     attr = &_POSIX_Threads_Default_attributes;
    252 
    253     /*  Initialize the affinity to be the default cpu set for the system */
    254     affinity = _CPU_set_Default();
    255     _Assert( affinity->setsize == sizeof( attr->affinitysetpreallocated ) );
    256     attr->affinityset             = &attr->affinitysetpreallocated;
    257     attr->affinitysetsize         = affinity->setsize;
    258     CPU_COPY( affinity->set, attr->affinityset );
    259   #endif
    260 
    261246  _Thread_Initialize_information(
    262247    &_POSIX_Threads_Information, /* object information table */
  • testsuites/psxtests/psxgetattrnp01/init.c

    r8c5267a r4f9ed26  
    191191  size_t              guardsize;
    192192  struct sched_param  param;
     193  cpu_set_t           set;
    193194
    194195  TEST_BEGIN();
     
    210211  puts("Init - pthread_attr_init");
    211212  sc = pthread_attr_init(&Thread_attr);
     213  rtems_test_assert(!sc);
     214
     215  puts("Init - pthread_attr_setaffinity_np");
     216  CPU_ZERO( &set );
     217  CPU_SET( 0, &set );
     218  sc = pthread_attr_setaffinity_np( &Thread_attr, sizeof( set ), &set );
    212219  rtems_test_assert(!sc);
    213220
  • testsuites/psxtests/psxgetattrnp01/psxgetattrnp01.scn

    r8c5267a r4f9ed26  
    33Init - pthread_getattr_np - invalid id - ESRCH
    44Init - pthread_attr_init
     5Init - pthread_attr_setaffinity_np
    56Init - pthread_attr_setinheritsched - PTHREAD_EXPLICIT_SCHED
    67Init - pthread_attr_setschedpolicy to SCHED_RR
Note: See TracChangeset for help on using the changeset viewer.