Changeset 98ed15e in rtems


Ignore:
Timestamp:
Jun 11, 1996, 4:01:37 PM (25 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
12aeff91
Parents:
d0baf81
Message:

Basic signal functionality appears to work. pthread_kill() can successfully
send signals to the current thread or to another blocked thread. nanosleep()
can be interrupted by a signal and return the time remaining.

Post switch extension added to dispatch posix signal handlers.

Files:
6 edited

Legend:

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

    rd0baf81 r98ed15e  
    128128  if ( !do_callout )
    129129    return FALSE;
     130
     131  /*
     132   *  Since we made a union of these, only one test is necessary but this is
     133   *  safer.
     134   */
     135
     136  assert( _POSIX_signals_Vectors[ signo ].sa_handler ||
     137          _POSIX_signals_Vectors[ signo ].sa_sigaction );
    130138 
    131139  switch ( _POSIX_signals_Vectors[ signo ].sa_flags ) {
     
    151159}
    152160
    153 void _POSIX_signals_Run_Them(
     161void _POSIX_signals_Post_switch_extension(
    154162  Thread_Control  *the_thread
    155163)
     
    377385  _POSIX_signals_Vectors[ sig ] = *act;
    378386
    379   return POSIX_NOT_IMPLEMENTED();
     387  return 0;
    380388}
    381389
     
    605613       */
    606614
    607       api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
     615      api = the_thread->API_Extensions[ THREAD_API_POSIX ];
    608616
    609617      if ( sig ) {
     
    616624          the_thread->do_post_task_switch_extension = TRUE;
    617625
    618           /* XXX may have to unblock the task */
    619 
     626 
     627          /* XXX may have to unblock the task -- this is a kludge -- fix it */
     628          if ( the_thread->current_state & STATES_INTERRUPTIBLE_BY_SIGNAL ) {
     629            the_thread->Wait.return_code = EINTR;
     630            if ( _States_Is_waiting_on_thread_queue(the_thread->current_state) )
     631              _Thread_queue_Extract_with_proxy( the_thread );
     632            else if ( _States_Is_delaying(the_thread->current_state)){
     633              if ( _Watchdog_Is_active( &the_thread->Timer ) )
     634                (void) _Watchdog_Remove( &the_thread->Timer );
     635              _Thread_Unblock( the_thread );
     636            }
    620637        }
    621638      }
    622       _Thread_Enable_dispatch();
    623       return 0;
     639    }
     640    _Thread_Enable_dispatch();
     641    return 0;
    624642  }
    625643
  • c/src/exec/posix/src/pthread.c

    rd0baf81 r98ed15e  
    1616#include <rtems/posix/pthread.h>
    1717#include <rtems/posix/priority.h>
     18#include <rtems/posix/psignal.h>
    1819#include <rtems/posix/config.h>
    1920#include <rtems/posix/key.h>
     
    223224  NULL,                                     /* predriver */
    224225  _POSIX_Threads_Initialize_user_threads,   /* postdriver */
    225   NULL,                                     /* post switch */
     226  _POSIX_signals_Post_switch_extension,     /* post switch */
    226227};
    227228 
  • c/src/exec/posix/src/time.c

    rd0baf81 r98ed15e  
    248248 
    249249  _Thread_Disable_dispatch();
    250     _Thread_Set_state( _Thread_Executing, STATES_WAITING_FOR_TIME );
     250    _Thread_Set_state(
     251      _Thread_Executing,
     252      STATES_DELAYING | STATES_INTERRUPTIBLE_BY_SIGNAL
     253    );
    251254    _Watchdog_Initialize(
    252255      &_Thread_Executing->Timer,
  • cpukit/posix/src/psignal.c

    rd0baf81 r98ed15e  
    128128  if ( !do_callout )
    129129    return FALSE;
     130
     131  /*
     132   *  Since we made a union of these, only one test is necessary but this is
     133   *  safer.
     134   */
     135
     136  assert( _POSIX_signals_Vectors[ signo ].sa_handler ||
     137          _POSIX_signals_Vectors[ signo ].sa_sigaction );
    130138 
    131139  switch ( _POSIX_signals_Vectors[ signo ].sa_flags ) {
     
    151159}
    152160
    153 void _POSIX_signals_Run_Them(
     161void _POSIX_signals_Post_switch_extension(
    154162  Thread_Control  *the_thread
    155163)
     
    377385  _POSIX_signals_Vectors[ sig ] = *act;
    378386
    379   return POSIX_NOT_IMPLEMENTED();
     387  return 0;
    380388}
    381389
     
    605613       */
    606614
    607       api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
     615      api = the_thread->API_Extensions[ THREAD_API_POSIX ];
    608616
    609617      if ( sig ) {
     
    616624          the_thread->do_post_task_switch_extension = TRUE;
    617625
    618           /* XXX may have to unblock the task */
    619 
     626 
     627          /* XXX may have to unblock the task -- this is a kludge -- fix it */
     628          if ( the_thread->current_state & STATES_INTERRUPTIBLE_BY_SIGNAL ) {
     629            the_thread->Wait.return_code = EINTR;
     630            if ( _States_Is_waiting_on_thread_queue(the_thread->current_state) )
     631              _Thread_queue_Extract_with_proxy( the_thread );
     632            else if ( _States_Is_delaying(the_thread->current_state)){
     633              if ( _Watchdog_Is_active( &the_thread->Timer ) )
     634                (void) _Watchdog_Remove( &the_thread->Timer );
     635              _Thread_Unblock( the_thread );
     636            }
    620637        }
    621638      }
    622       _Thread_Enable_dispatch();
    623       return 0;
     639    }
     640    _Thread_Enable_dispatch();
     641    return 0;
    624642  }
    625643
  • cpukit/posix/src/pthread.c

    rd0baf81 r98ed15e  
    1616#include <rtems/posix/pthread.h>
    1717#include <rtems/posix/priority.h>
     18#include <rtems/posix/psignal.h>
    1819#include <rtems/posix/config.h>
    1920#include <rtems/posix/key.h>
     
    223224  NULL,                                     /* predriver */
    224225  _POSIX_Threads_Initialize_user_threads,   /* postdriver */
    225   NULL,                                     /* post switch */
     226  _POSIX_signals_Post_switch_extension,     /* post switch */
    226227};
    227228 
  • cpukit/posix/src/time.c

    rd0baf81 r98ed15e  
    248248 
    249249  _Thread_Disable_dispatch();
    250     _Thread_Set_state( _Thread_Executing, STATES_WAITING_FOR_TIME );
     250    _Thread_Set_state(
     251      _Thread_Executing,
     252      STATES_DELAYING | STATES_INTERRUPTIBLE_BY_SIGNAL
     253    );
    251254    _Watchdog_Initialize(
    252255      &_Thread_Executing->Timer,
Note: See TracChangeset for help on using the changeset viewer.