Changeset a1f0ca28 in rtems for cpukit


Ignore:
Timestamp:
Aug 19, 2009, 3:18:19 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
0fed29a
Parents:
4e7ca87
Message:

2009-08-19 Joel Sherrill <joel.sherrill@…>

  • posix/src/pthread.c: Address sporadic server edge cases. Do not change priority if thread is holding a priority ceiling or inheritance mutex. Do not change it if it looks like the thread has manually changed its priority. Style cleanup on file with new comments added.
Location:
cpukit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r4e7ca87 ra1f0ca28  
     12009-08-19      Joel Sherrill <joel.sherrill@OARcorp.com>
     2
     3        * posix/src/pthread.c: Address sporadic server edge cases. Do not
     4        change priority if thread is holding a priority ceiling or
     5        inheritance mutex. Do not change it if it looks like the thread has
     6        manually changed its priority. Style cleanup on file with new
     7        comments added.
     8
    192009-08-18      Joel Sherrill <joel.sherrill@oarcorp.com>
    210
  • cpukit/posix/src/pthread.c

    r4e7ca87 ra1f0ca28  
    11/*
    2  *  COPYRIGHT (c) 1989-2008.
     2 *  COPYRIGHT (c) 1989-2009.
    33 *  On-Line Applications Research Corporation (OAR).
    44 *
     
    3434#include <rtems/score/timespec.h>
    3535
    36 /*PAGE
    37  *
     36/*
    3837 *  The default pthreads attributes structure.
    3938 *
    4039 *  NOTE: Be careful .. if the default attribute set changes,
    4140 *        _POSIX_Threads_Initialize_user_threads will need to be examined.
    42  *
    43  */
    44 
     41 */
    4542const pthread_attr_t _POSIX_Threads_Default_attributes = {
    4643  true,                       /* is_initialized */
     
    6057};
    6158
    62 /*PAGE
    63  *
     59/*
    6460 *  _POSIX_Threads_Sporadic_budget_TSR
    6561 */
    66 
    6762void _POSIX_Threads_Sporadic_budget_TSR(
    6863  Objects_Id      id __attribute__((unused)),
     
    8782  the_thread->real_priority = new_priority;
    8883
    89   if ( the_thread->resource_count == 0 ||
    90        the_thread->current_priority > new_priority )
    91     _Thread_Change_priority( the_thread, new_priority, true );
     84  /*
     85   *  If holding a resource, then do not change it.
     86   */
     87  #if 0
     88    printk( "TSR %d %d %d\n", the_thread->resource_count,
     89        the_thread->current_priority, new_priority );
     90  #endif
     91  if ( the_thread->resource_count == 0 ) {
     92    /*
     93     *  If this would make them less important, then do not change it.
     94     */
     95    if ( the_thread->current_priority > new_priority ) {
     96      _Thread_Change_priority( the_thread, new_priority, true );
     97      #if 0
     98        printk( "raise priority\n" );
     99      #endif
     100    }
     101  }
    92102
    93103  /* ticks is guaranteed to be at least one */
     
    97107}
    98108
    99 /*PAGE
    100  *
     109/*
    101110 *  _POSIX_Threads_Sporadic_budget_callout
    102111 */
    103 
    104112void _POSIX_Threads_Sporadic_budget_callout(
    105113  Thread_Control *the_thread
     
    115123   *  while at low priority.
    116124   */
    117 
    118 
    119125  the_thread->cpu_time_budget = 0xFFFFFFFF; /* XXX should be based on MAX_U32 */
    120126
     
    122128  the_thread->real_priority = new_priority;
    123129
    124  if ( the_thread->resource_count == 0 ||
    125       the_thread->current_priority > new_priority )
    126     _Thread_Change_priority( the_thread, new_priority, true );
    127 }
    128 
    129 /*PAGE
    130  *
     130  /*
     131   *  If holding a resource, then do not change it.
     132   */
     133  #if 0
     134    printk( "callout %d %d %d\n", the_thread->resource_count,
     135        the_thread->current_priority, new_priority );
     136  #endif
     137  if ( the_thread->resource_count == 0 ) {
     138    /*
     139     *  Make sure we are actually lowering it. If they have lowered it
     140     *  to logically lower than ss_low_priority, then we do not want to
     141     *  change it.
     142     */
     143    if ( the_thread->current_priority < new_priority ) {
     144      _Thread_Change_priority( the_thread, new_priority, true );
     145      #if 0
     146        printk( "lower priority\n" );
     147      #endif
     148    }
     149  }
     150}
     151
     152/*
    131153 *  _POSIX_Threads_Create_extension
    132154 *
    133  *  XXX
     155 *  This method is invoked for each thread created.
    134156 */
    135157
     
    176198  if ( _Objects_Get_API( created->Object.id ) == OBJECTS_POSIX_API
    177199       #if defined(RTEMS_DEBUG)
    178         && _Objects_Get_class( created->Object.id ) == 1
     200        && _Objects_Get_class( created->Object.id ) == 1
    179201       #endif
    180202  ) {
     
    202224}
    203225
    204 /*PAGE
    205  *
     226/*
    206227 *  _POSIX_Threads_Delete_extension
    207  */
    208 
     228 *
     229 *  This method is invoked for each thread deleted.
     230 */
    209231User_extensions_routine _POSIX_Threads_Delete_extension(
    210232  Thread_Control *executing __attribute__((unused)),
     
    245267
    246268/*
    247  *
    248269 *  _POSIX_Threads_Exitted_extension
    249  */
    250 
     270 *
     271 *  This method is invoked each time a thread exits.
     272 */
    251273User_extensions_routine _POSIX_Threads_Exitted_extension(
    252274  Thread_Control *executing
     
    261283}
    262284
    263 /*PAGE
    264  *
     285/*
    265286 *  _POSIX_Threads_Initialize_user_threads
    266287 *
    267288 *  This routine creates and starts all configured user
    268289 *  initialzation threads.
    269  *
    270  *  Input parameters: NONE
    271  *
    272  *  Output parameters:  NONE
    273  */
    274 
     290 */
    275291void _POSIX_Threads_Initialize_user_threads( void )
    276292{
     
    279295}
    280296
    281 /*PAGE
    282  *
     297/*
    283298 *  API Extension control structures
    284299 */
    285 
    286300API_extensions_Control _POSIX_Threads_API_extensions = {
    287301  { NULL, NULL },
     
    307321};
    308322
    309 /*PAGE
    310  *
     323/*
    311324 *  _POSIX_Threads_Manager_initialization
    312325 *
    313326 *  This routine initializes all threads manager related data structures.
    314  *
    315  *  Input parameters:   NONE
    316  *
    317  *  Output parameters:  NONE
    318  */
    319 
     327 */
    320328void _POSIX_Threads_Manager_initialization(void)
    321329{
    322   /*
    323    *  There may not be any POSIX initialization threads configured.
    324    */
    325 
    326 #if 0
    327   if ( user_threads == NULL || number_of_initialization_threads == 0 )
    328     _Internal_error_Occurred( INTERNAL_ERROR_POSIX_API, true, EINVAL );
    329 #endif
    330 
    331330  _Objects_Initialize_information(
    332331    &_POSIX_Threads_Information, /* object information table */
     
    349348   *  Add all the extensions for this API
    350349   */
    351 
    352350  _User_extensions_Add_API_set( &_POSIX_Threads_User_extensions );
    353351
    354352  _API_extensions_Add( &_POSIX_Threads_API_extensions );
    355 
    356353
    357354  /*
     
    359356   *       Register the MP Process Packet routine.
    360357   */
    361 
    362 }
     358}
Note: See TracChangeset for help on using the changeset viewer.