Changeset cfcfdf0 in rtems


Ignore:
Timestamp:
May 29, 1996, 8:55:05 PM (24 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
2197a2e1
Parents:
5e0efa2b
Message:

added pthread_exit

first posix thread ran

Files:
2 edited

Legend:

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

    r5e0efa2b rcfcfdf0  
    539539)
    540540{
    541   const pthread_attr_t  *local_attr;
     541  const pthread_attr_t  *attrp;
    542542  Priority_Control       core_priority;
    543543  boolean                is_fp;
     
    546546  char                  *default_name = "psx";
    547547
    548   local_attr = (attr) ? attr : &_POSIX_Threads_Default_attributes;
    549 
    550   if ( !local_attr->is_initialized )
     548  attrp = (attr) ? attr : &_POSIX_Threads_Default_attributes;
     549
     550  if ( !attrp->is_initialized )
    551551    return EINVAL;
    552552
     
    572572   */
    573573 
    574   if ( !_POSIX_Priority_Is_valid( attr->schedparam.sched_priority ) )
    575     return EINVAL;
    576  
    577   core_priority = _POSIX_Priority_To_core( attr->schedparam.sched_priority );
     574  if ( !_POSIX_Priority_Is_valid( attrp->schedparam.sched_priority ) )
     575    return EINVAL;
     576 
     577  core_priority = _POSIX_Priority_To_core( attrp->schedparam.sched_priority );
    578578 
    579579  /*
     
    609609    &_POSIX_Threads_Information,
    610610    the_thread,
    611     attr->stackaddr,
    612     attr->stacksize,
     611    attrp->stackaddr,
     612    attrp->stacksize,
    613613    is_fp,
    614614    core_priority,
     
    625625  }
    626626
     627  status = _Thread_Start(
     628    the_thread,
     629    THREAD_START_POINTER,
     630    start_routine,
     631    arg,
     632    0                     /* unused */
     633  );
     634
     635  /*
     636   *  _Thread_Start only fails if the thread was in the incorrect state
     637   */
     638
     639  if ( !status ) {
     640    _POSIX_Threads_Free( the_thread );
     641    _Thread_Enable_dispatch();
     642    return EINVAL;
     643  }
     644
     645
     646  /*
     647   *  Return the id and indicate we successfully created the thread
     648   */
     649
    627650  *thread = the_thread->Object.id;
    628651
     
    667690)
    668691{
    669   POSIX_NOT_IMPLEMENTED();
     692  register Thread_Control *the_thread;
     693
     694  the_thread = _Thread_Executing;
     695
     696  _Thread_Disable_dispatch();
     697
     698  /*
     699   *  XXX Will need to deal with join/detach
     700   */
     701
     702  _Thread_Close( &_POSIX_Threads_Information, the_thread );
     703 
     704  _POSIX_Threads_Free( the_thread );
     705
     706  _Thread_Enable_dispatch();
    670707}
    671708
  • cpukit/posix/src/pthread.c

    r5e0efa2b rcfcfdf0  
    539539)
    540540{
    541   const pthread_attr_t  *local_attr;
     541  const pthread_attr_t  *attrp;
    542542  Priority_Control       core_priority;
    543543  boolean                is_fp;
     
    546546  char                  *default_name = "psx";
    547547
    548   local_attr = (attr) ? attr : &_POSIX_Threads_Default_attributes;
    549 
    550   if ( !local_attr->is_initialized )
     548  attrp = (attr) ? attr : &_POSIX_Threads_Default_attributes;
     549
     550  if ( !attrp->is_initialized )
    551551    return EINVAL;
    552552
     
    572572   */
    573573 
    574   if ( !_POSIX_Priority_Is_valid( attr->schedparam.sched_priority ) )
    575     return EINVAL;
    576  
    577   core_priority = _POSIX_Priority_To_core( attr->schedparam.sched_priority );
     574  if ( !_POSIX_Priority_Is_valid( attrp->schedparam.sched_priority ) )
     575    return EINVAL;
     576 
     577  core_priority = _POSIX_Priority_To_core( attrp->schedparam.sched_priority );
    578578 
    579579  /*
     
    609609    &_POSIX_Threads_Information,
    610610    the_thread,
    611     attr->stackaddr,
    612     attr->stacksize,
     611    attrp->stackaddr,
     612    attrp->stacksize,
    613613    is_fp,
    614614    core_priority,
     
    625625  }
    626626
     627  status = _Thread_Start(
     628    the_thread,
     629    THREAD_START_POINTER,
     630    start_routine,
     631    arg,
     632    0                     /* unused */
     633  );
     634
     635  /*
     636   *  _Thread_Start only fails if the thread was in the incorrect state
     637   */
     638
     639  if ( !status ) {
     640    _POSIX_Threads_Free( the_thread );
     641    _Thread_Enable_dispatch();
     642    return EINVAL;
     643  }
     644
     645
     646  /*
     647   *  Return the id and indicate we successfully created the thread
     648   */
     649
    627650  *thread = the_thread->Object.id;
    628651
     
    667690)
    668691{
    669   POSIX_NOT_IMPLEMENTED();
     692  register Thread_Control *the_thread;
     693
     694  the_thread = _Thread_Executing;
     695
     696  _Thread_Disable_dispatch();
     697
     698  /*
     699   *  XXX Will need to deal with join/detach
     700   */
     701
     702  _Thread_Close( &_POSIX_Threads_Information, the_thread );
     703 
     704  _POSIX_Threads_Free( the_thread );
     705
     706  _Thread_Enable_dispatch();
    670707}
    671708
Note: See TracChangeset for help on using the changeset viewer.