Changeset 0123e3b in rtems


Ignore:
Timestamp:
May 17, 1999, 11:20:52 PM (22 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
c9973bb
Parents:
1dc030f
Message:

Split Signal Manager into one routine per file.

Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/rtems/src/Makefile.in

    r1dc030f r0123e3b  
    4444  event eventreceive eventseize eventsend eventsurrender eventtimeout
    4545
     46SIGNAL_PIECES=\
     47  signal signalcatch signalsend
     48
    4649RATEMON_PIECES=\
    4750  ratemon ratemoncancel ratemoncreate ratemondelete ratemongetstatus \
     
    6467  $(CLOCK_PIECES) $(TIMER_PIECES) \
    6568  $(SEMAPHORE_PIECES) $(MESSAGE_QUEUE_PIECES) \
    66   $(EVENT_PIECES) signal
     69  $(EVENT_PIECES) $(SIGNAL_PIECES) \
    6770  $(PARTITION_PIECES) $(REGION_PIECES) $(DPMEM_PIECES) \
    6871  $(MP_PIECES)
  • c/src/exec/rtems/src/signal.c

    r1dc030f r0123e3b  
    4747#endif
    4848}
    49  
    50 /*PAGE
    51  *
    52  *  rtems_signal_catch
    53  *
    54  *  This directive allows a thread to specify what action to take when
    55  *  catching signals.
    56  *
    57  *  Input parameters:
    58  *    handler  - address of asynchronous signal routine (asr)
    59  *              ( NULL indicates asr is invalid )
    60  *    mode_set - mode value for asr
    61  *
    62  *  Output parameters:
    63  *    RTEMS_SUCCESSFUL - always succeeds
    64  */
    65 
    66 rtems_status_code rtems_signal_catch(
    67   rtems_asr_entry   asr_handler,
    68   rtems_mode        mode_set
    69 )
    70 {
    71   Thread_Control     *executing;
    72   RTEMS_API_Control  *api;
    73   ASR_Information    *asr;
    74 
    75 /* XXX normalize mode */
    76   executing = _Thread_Executing;
    77   api = executing->API_Extensions[ THREAD_API_RTEMS ];
    78   asr = &api->Signal;
    79 
    80   _Thread_Disable_dispatch(); /* cannot reschedule while */
    81                               /*   the thread is inconsistent */
    82 
    83   if ( !_ASR_Is_null_handler( asr_handler ) ) {
    84     asr->mode_set = mode_set;
    85     asr->handler = asr_handler;
    86   }
    87   else
    88     _ASR_Initialize( asr );
    89   _Thread_Enable_dispatch();
    90   return RTEMS_SUCCESSFUL;
    91 }
    92 
    93 /*PAGE
    94  *
    95  *  rtems_signal_send
    96  *
    97  *  This directive allows a thread to send signals to a thread.
    98  *
    99  *  Input parameters:
    100  *    id         - thread id
    101  *    signal_set - signal set
    102  *
    103  *  Output parameters:
    104  *    RTEMS_SUCCESSFUL - if successful
    105  *    error code - if unsuccessful
    106  */
    107 
    108 rtems_status_code rtems_signal_send(
    109   Objects_Id             id,
    110   rtems_signal_set signal_set
    111 )
    112 {
    113   register Thread_Control *the_thread;
    114   Objects_Locations        location;
    115   RTEMS_API_Control       *api;
    116   ASR_Information         *asr;
    117 
    118   the_thread = _Thread_Get( id, &location );
    119   switch ( location ) {
    120 
    121     case OBJECTS_REMOTE:
    122 #if defined(RTEMS_MULTIPROCESSING)
    123       return _Signal_MP_Send_request_packet(
    124         SIGNAL_MP_SEND_REQUEST,
    125         id,
    126         signal_set
    127       );
    128 #endif
    129 
    130     case OBJECTS_ERROR:
    131       return RTEMS_INVALID_ID;
    132 
    133     case OBJECTS_LOCAL:
    134       api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
    135       asr = &api->Signal;
    136 
    137       if ( ! _ASR_Is_null_handler( asr->handler ) ) {
    138         if ( asr->is_enabled ) {
    139           _ASR_Post_signals( signal_set, &asr->signals_posted );
    140 
    141           the_thread->do_post_task_switch_extension = TRUE;
    142 
    143           if ( _ISR_Is_in_progress() && _Thread_Is_executing( the_thread ) )
    144             _ISR_Signals_to_thread_executing = TRUE;
    145         } else {
    146           _ASR_Post_signals( signal_set, &asr->signals_pending );
    147         }
    148         _Thread_Enable_dispatch();
    149         return RTEMS_SUCCESSFUL;
    150       }
    151       _Thread_Enable_dispatch();
    152       return RTEMS_NOT_DEFINED;
    153   }
    154 
    155   return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    156 }
  • cpukit/rtems/src/signal.c

    r1dc030f r0123e3b  
    4747#endif
    4848}
    49  
    50 /*PAGE
    51  *
    52  *  rtems_signal_catch
    53  *
    54  *  This directive allows a thread to specify what action to take when
    55  *  catching signals.
    56  *
    57  *  Input parameters:
    58  *    handler  - address of asynchronous signal routine (asr)
    59  *              ( NULL indicates asr is invalid )
    60  *    mode_set - mode value for asr
    61  *
    62  *  Output parameters:
    63  *    RTEMS_SUCCESSFUL - always succeeds
    64  */
    65 
    66 rtems_status_code rtems_signal_catch(
    67   rtems_asr_entry   asr_handler,
    68   rtems_mode        mode_set
    69 )
    70 {
    71   Thread_Control     *executing;
    72   RTEMS_API_Control  *api;
    73   ASR_Information    *asr;
    74 
    75 /* XXX normalize mode */
    76   executing = _Thread_Executing;
    77   api = executing->API_Extensions[ THREAD_API_RTEMS ];
    78   asr = &api->Signal;
    79 
    80   _Thread_Disable_dispatch(); /* cannot reschedule while */
    81                               /*   the thread is inconsistent */
    82 
    83   if ( !_ASR_Is_null_handler( asr_handler ) ) {
    84     asr->mode_set = mode_set;
    85     asr->handler = asr_handler;
    86   }
    87   else
    88     _ASR_Initialize( asr );
    89   _Thread_Enable_dispatch();
    90   return RTEMS_SUCCESSFUL;
    91 }
    92 
    93 /*PAGE
    94  *
    95  *  rtems_signal_send
    96  *
    97  *  This directive allows a thread to send signals to a thread.
    98  *
    99  *  Input parameters:
    100  *    id         - thread id
    101  *    signal_set - signal set
    102  *
    103  *  Output parameters:
    104  *    RTEMS_SUCCESSFUL - if successful
    105  *    error code - if unsuccessful
    106  */
    107 
    108 rtems_status_code rtems_signal_send(
    109   Objects_Id             id,
    110   rtems_signal_set signal_set
    111 )
    112 {
    113   register Thread_Control *the_thread;
    114   Objects_Locations        location;
    115   RTEMS_API_Control       *api;
    116   ASR_Information         *asr;
    117 
    118   the_thread = _Thread_Get( id, &location );
    119   switch ( location ) {
    120 
    121     case OBJECTS_REMOTE:
    122 #if defined(RTEMS_MULTIPROCESSING)
    123       return _Signal_MP_Send_request_packet(
    124         SIGNAL_MP_SEND_REQUEST,
    125         id,
    126         signal_set
    127       );
    128 #endif
    129 
    130     case OBJECTS_ERROR:
    131       return RTEMS_INVALID_ID;
    132 
    133     case OBJECTS_LOCAL:
    134       api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
    135       asr = &api->Signal;
    136 
    137       if ( ! _ASR_Is_null_handler( asr->handler ) ) {
    138         if ( asr->is_enabled ) {
    139           _ASR_Post_signals( signal_set, &asr->signals_posted );
    140 
    141           the_thread->do_post_task_switch_extension = TRUE;
    142 
    143           if ( _ISR_Is_in_progress() && _Thread_Is_executing( the_thread ) )
    144             _ISR_Signals_to_thread_executing = TRUE;
    145         } else {
    146           _ASR_Post_signals( signal_set, &asr->signals_pending );
    147         }
    148         _Thread_Enable_dispatch();
    149         return RTEMS_SUCCESSFUL;
    150       }
    151       _Thread_Enable_dispatch();
    152       return RTEMS_NOT_DEFINED;
    153   }
    154 
    155   return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    156 }
Note: See TracChangeset for help on using the changeset viewer.