Changeset 65c421f in rtems


Ignore:
Timestamp:
Sep 5, 1996, 8:45:05 PM (24 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
7fea679b
Parents:
297be5c
Message:

default thread attributes: default value for inheritsched changed from
explicit to inherit scheduler to be consistent with FSU pthreads for gnat.

_POSIX_Threads_Create_extension: now inherit signal blocked mask from
creator if the new thread is a posix thread.

_POSIX_Threads_Initialize_user_threads: make sure posix initialization
threads start with a useful priority. If they inherit the priority
of the creating thread, they will end up at the same priority as the
idle thread. Since the idle thread does not yield, they will not run.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/posix/src/pthread.c

    r297be5c r65c421f  
    2525 *
    2626 *  The default pthreads attributes structure.
     27 *
     28 *  NOTE: Be careful .. if the default attribute set changes,
     29 *        _POSIX_Threads_Initialize_user_threads will need to be examined.
     30 *
    2731 */
    2832 
     
    3236  PTHREAD_MINIMUM_STACK_SIZE, /* stacksize */
    3337  PTHREAD_SCOPE_PROCESS,      /* contentionscope */
    34   PTHREAD_EXPLICIT_SCHED,     /* inheritsched */
     38  PTHREAD_INHERIT_SCHED,      /* inheritsched */
    3539  SCHED_FIFO,                 /* schedpolicy */
    3640  {                           /* schedparam */
     
    128132{
    129133  POSIX_API_Control *api;
     134  POSIX_API_Control *executing_api;
    130135 
    131136  api = _Workspace_Allocate( sizeof( POSIX_API_Control ) );
     
    151156  /* XXX use signal constants */
    152157  api->signals_pending = 0;
    153   if ( _Objects_Get_class( created->Object.id ) == OBJECTS_POSIX_THREADS )
    154     api->signals_blocked = 0;
    155   else
     158  if ( _Objects_Get_class( created->Object.id ) == OBJECTS_POSIX_THREADS ) {
     159    executing_api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
     160    api->signals_blocked = api->signals_blocked;
     161  } else
    156162    api->signals_blocked = 0xffffffff;
    157163
     
    233239  posix_initialization_threads_table *user_threads;
    234240  pthread_t                           thread_id;
     241  pthread_attr_t                      attr;
    235242 
    236243  user_threads = _POSIX_Threads_User_initialization_threads;
     
    240247    return;
    241248 
     249  /*
     250   *  Be careful .. if the default attribute set changes, this may need to.
     251   *
     252   *  Setting the attributes explicitly is critical, since we don't want
     253   *  to inherit the idle tasks attributes.
     254   */
     255
    242256  for ( index=0 ; index < maximum ; index++ ) {
     257    status = pthread_attr_init( &attr );
     258    assert( !status );
     259     
     260    status = pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED );
     261    assert( !status );
     262
    243263    status = pthread_create(
    244264      &thread_id,
    245       NULL,
     265      &attr,
    246266      user_threads[ index ].entry,
    247267      NULL
  • cpukit/posix/src/pthread.c

    r297be5c r65c421f  
    2525 *
    2626 *  The default pthreads attributes structure.
     27 *
     28 *  NOTE: Be careful .. if the default attribute set changes,
     29 *        _POSIX_Threads_Initialize_user_threads will need to be examined.
     30 *
    2731 */
    2832 
     
    3236  PTHREAD_MINIMUM_STACK_SIZE, /* stacksize */
    3337  PTHREAD_SCOPE_PROCESS,      /* contentionscope */
    34   PTHREAD_EXPLICIT_SCHED,     /* inheritsched */
     38  PTHREAD_INHERIT_SCHED,      /* inheritsched */
    3539  SCHED_FIFO,                 /* schedpolicy */
    3640  {                           /* schedparam */
     
    128132{
    129133  POSIX_API_Control *api;
     134  POSIX_API_Control *executing_api;
    130135 
    131136  api = _Workspace_Allocate( sizeof( POSIX_API_Control ) );
     
    151156  /* XXX use signal constants */
    152157  api->signals_pending = 0;
    153   if ( _Objects_Get_class( created->Object.id ) == OBJECTS_POSIX_THREADS )
    154     api->signals_blocked = 0;
    155   else
     158  if ( _Objects_Get_class( created->Object.id ) == OBJECTS_POSIX_THREADS ) {
     159    executing_api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
     160    api->signals_blocked = api->signals_blocked;
     161  } else
    156162    api->signals_blocked = 0xffffffff;
    157163
     
    233239  posix_initialization_threads_table *user_threads;
    234240  pthread_t                           thread_id;
     241  pthread_attr_t                      attr;
    235242 
    236243  user_threads = _POSIX_Threads_User_initialization_threads;
     
    240247    return;
    241248 
     249  /*
     250   *  Be careful .. if the default attribute set changes, this may need to.
     251   *
     252   *  Setting the attributes explicitly is critical, since we don't want
     253   *  to inherit the idle tasks attributes.
     254   */
     255
    242256  for ( index=0 ; index < maximum ; index++ ) {
     257    status = pthread_attr_init( &attr );
     258    assert( !status );
     259     
     260    status = pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED );
     261    assert( !status );
     262
    243263    status = pthread_create(
    244264      &thread_id,
    245       NULL,
     265      &attr,
    246266      user_threads[ index ].entry,
    247267      NULL
Note: See TracChangeset for help on using the changeset viewer.