Changeset 230a0dcb in rtems


Ignore:
Timestamp:
Jun 4, 1996, 7:44:16 PM (25 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
56bd4a36
Parents:
3ff4688
Message:

added some of the required functionality to pthread_setschedparam and
pthread_getschedparam.

Files:
2 edited

Legend:

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

    r3ff4688 r230a0dcb  
    383383)
    384384{
    385   pthread_attr_t *attr;   /* XXX: really need to get this from the thread */
     385  POSIX_API_Control  *api;
    386386
    387387  if ( !policy || !param  )
    388388    return EINVAL;
    389389
    390   *policy = attr->schedpolicy;
    391   *param  = attr->schedparam;
     390  api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
     391  *policy = api->schedpolicy;
     392  *param  = api->Schedule;
    392393  return 0;
    393394}
     
    405406)
    406407{
     408  register Thread_Control *the_thread;
     409  POSIX_API_Control       *api;
     410  Objects_Locations        location;
     411 
     412  if ( !param )
     413    return EINVAL;
     414
    407415  /* XXX need to reschedule after doing this to the thread */
    408   pthread_attr_t *attr;   /* XXX: really need to get this from the thread */
    409 
    410   if ( !param )
    411     return EINVAL;
    412 
    413   switch ( policy ) {
    414     case SCHED_OTHER:
    415     case SCHED_FIFO:
    416     case SCHED_RR:
    417     case SCHED_SPORADIC:
    418       attr->schedpolicy = policy;
    419       attr->schedparam  = *param;
     416  /* XXX need to have one routine called by create and here */
     417#warning "pthread_setschedparam needs work"
     418
     419  the_thread = _POSIX_Threads_Get( thread, &location );
     420  switch ( location ) {
     421    case OBJECTS_ERROR:
     422    case OBJECTS_REMOTE:
     423      return ESRCH;
     424    case OBJECTS_LOCAL:
     425      switch ( policy ) {
     426        case SCHED_OTHER:
     427        case SCHED_FIFO:
     428        case SCHED_RR:
     429        case SCHED_SPORADIC:
     430          /* XXX this is where the interpretation work should go */
     431          break;
     432 
     433        default:
     434          return EINVAL;
     435      }
     436
     437      api = the_thread->API_Extensions[ THREAD_API_POSIX ];
     438
     439      api->schedpolicy = policy;
     440      api->Schedule    = *param;
    420441      return 0;
    421  
    422     default:
    423       return EINVAL;
    424   }
     442  }
     443 
     444  return POSIX_BOTTOM_REACHED();
     445
     446
     447#if 0
     448#endif
    425449}
    426450
     
    782806      api = the_thread->API_Extensions[ THREAD_API_POSIX ];
    783807
    784       if ( api->detachstate == PTHREAD_CREATE_DETACHED )
     808      if ( api->detachstate == PTHREAD_CREATE_DETACHED ) {
     809        _Thread_Enable_dispatch();
    785810        return EINVAL;
     811      }
    786812
    787813      /*
     
    823849      api = the_thread->API_Extensions[ THREAD_API_POSIX ];
    824850      api->detachstate = PTHREAD_CREATE_DETACHED;
     851      _Thread_Enable_dispatch();
    825852      return 0;
    826853  }
     
    884911)
    885912{
    886   Objects_Locations  location;
     913  int               status;
     914  Objects_Locations location;
    887915
    888916 /* XXX may want to do a "get" to make sure both are valid. */
    889917 /* XXX behavior is undefined if not valid pthread_t's */
    890918 
     919  /*
     920   *  By default this is not a match.
     921   */
     922
     923  status = 0;
     924
    891925  /*
    892926   *  Validate the first id and return 0 if it is not valid
     
    897931    case OBJECTS_ERROR:
    898932    case OBJECTS_REMOTE:
    899       return 0;
     933      break;
     934
    900935    case OBJECTS_LOCAL:
     936
     937      /*
     938       *  Validate the second id and return 0 if it is not valid
     939       */
     940
     941      (void) _POSIX_Threads_Get( t2, &location );
     942      switch ( location ) {
     943        case OBJECTS_ERROR:
     944        case OBJECTS_REMOTE:
     945          break;
     946        case OBJECTS_LOCAL:
     947          status = _Objects_Are_ids_equal( t1, t2 );
     948          break;
     949      }
     950      _Thread_Unnest_dispatch();
    901951      break;
    902952  }
    903953
    904   /*
    905    *  Validate the second id and return 0 if it is not valid
    906    */
    907 
    908   (void) _POSIX_Threads_Get( t2, &location );
    909   switch ( location ) {
    910     case OBJECTS_ERROR:
    911     case OBJECTS_REMOTE:
    912       return 0;
    913     case OBJECTS_LOCAL:
    914       break;
    915   }
    916   return _Objects_Are_ids_equal( t1, t2 );
     954  _Thread_Enable_dispatch();
     955  return status;
     956
    917957}
    918958
  • cpukit/posix/src/pthread.c

    r3ff4688 r230a0dcb  
    383383)
    384384{
    385   pthread_attr_t *attr;   /* XXX: really need to get this from the thread */
     385  POSIX_API_Control  *api;
    386386
    387387  if ( !policy || !param  )
    388388    return EINVAL;
    389389
    390   *policy = attr->schedpolicy;
    391   *param  = attr->schedparam;
     390  api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
     391  *policy = api->schedpolicy;
     392  *param  = api->Schedule;
    392393  return 0;
    393394}
     
    405406)
    406407{
     408  register Thread_Control *the_thread;
     409  POSIX_API_Control       *api;
     410  Objects_Locations        location;
     411 
     412  if ( !param )
     413    return EINVAL;
     414
    407415  /* XXX need to reschedule after doing this to the thread */
    408   pthread_attr_t *attr;   /* XXX: really need to get this from the thread */
    409 
    410   if ( !param )
    411     return EINVAL;
    412 
    413   switch ( policy ) {
    414     case SCHED_OTHER:
    415     case SCHED_FIFO:
    416     case SCHED_RR:
    417     case SCHED_SPORADIC:
    418       attr->schedpolicy = policy;
    419       attr->schedparam  = *param;
     416  /* XXX need to have one routine called by create and here */
     417#warning "pthread_setschedparam needs work"
     418
     419  the_thread = _POSIX_Threads_Get( thread, &location );
     420  switch ( location ) {
     421    case OBJECTS_ERROR:
     422    case OBJECTS_REMOTE:
     423      return ESRCH;
     424    case OBJECTS_LOCAL:
     425      switch ( policy ) {
     426        case SCHED_OTHER:
     427        case SCHED_FIFO:
     428        case SCHED_RR:
     429        case SCHED_SPORADIC:
     430          /* XXX this is where the interpretation work should go */
     431          break;
     432 
     433        default:
     434          return EINVAL;
     435      }
     436
     437      api = the_thread->API_Extensions[ THREAD_API_POSIX ];
     438
     439      api->schedpolicy = policy;
     440      api->Schedule    = *param;
    420441      return 0;
    421  
    422     default:
    423       return EINVAL;
    424   }
     442  }
     443 
     444  return POSIX_BOTTOM_REACHED();
     445
     446
     447#if 0
     448#endif
    425449}
    426450
     
    782806      api = the_thread->API_Extensions[ THREAD_API_POSIX ];
    783807
    784       if ( api->detachstate == PTHREAD_CREATE_DETACHED )
     808      if ( api->detachstate == PTHREAD_CREATE_DETACHED ) {
     809        _Thread_Enable_dispatch();
    785810        return EINVAL;
     811      }
    786812
    787813      /*
     
    823849      api = the_thread->API_Extensions[ THREAD_API_POSIX ];
    824850      api->detachstate = PTHREAD_CREATE_DETACHED;
     851      _Thread_Enable_dispatch();
    825852      return 0;
    826853  }
     
    884911)
    885912{
    886   Objects_Locations  location;
     913  int               status;
     914  Objects_Locations location;
    887915
    888916 /* XXX may want to do a "get" to make sure both are valid. */
    889917 /* XXX behavior is undefined if not valid pthread_t's */
    890918 
     919  /*
     920   *  By default this is not a match.
     921   */
     922
     923  status = 0;
     924
    891925  /*
    892926   *  Validate the first id and return 0 if it is not valid
     
    897931    case OBJECTS_ERROR:
    898932    case OBJECTS_REMOTE:
    899       return 0;
     933      break;
     934
    900935    case OBJECTS_LOCAL:
     936
     937      /*
     938       *  Validate the second id and return 0 if it is not valid
     939       */
     940
     941      (void) _POSIX_Threads_Get( t2, &location );
     942      switch ( location ) {
     943        case OBJECTS_ERROR:
     944        case OBJECTS_REMOTE:
     945          break;
     946        case OBJECTS_LOCAL:
     947          status = _Objects_Are_ids_equal( t1, t2 );
     948          break;
     949      }
     950      _Thread_Unnest_dispatch();
    901951      break;
    902952  }
    903953
    904   /*
    905    *  Validate the second id and return 0 if it is not valid
    906    */
    907 
    908   (void) _POSIX_Threads_Get( t2, &location );
    909   switch ( location ) {
    910     case OBJECTS_ERROR:
    911     case OBJECTS_REMOTE:
    912       return 0;
    913     case OBJECTS_LOCAL:
    914       break;
    915   }
    916   return _Objects_Are_ids_equal( t1, t2 );
     954  _Thread_Enable_dispatch();
     955  return status;
     956
    917957}
    918958
Note: See TracChangeset for help on using the changeset viewer.