source: rtems/cpukit/rtems/src/signal.c @ 7f6a24ab

4.104.114.84.95
Last change on this file since 7f6a24ab was 7f6a24ab, checked in by Joel Sherrill <joel.sherrill@…>, on 08/28/95 at 15:30:29

Added unused priority ceiling parameter to rtems_semaphore_create.

Rearranged code to created thread handler routines to initialize,
start, restart, and "close/delete" a thread.

Made internal threads their own object class. This now uses the
thread support routines for starting and initializing a thread.

Insured deleted tasks are freed to the Inactive pool associated with the
correct Information block.

Added an RTEMS API specific data area to the thread control block.

Beginnings of removing the word "rtems" from the core.

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/*
2 *  Signal Manager
3 *
4 *
5 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
6 *  On-Line Applications Research Corporation (OAR).
7 *  All rights assigned to U.S. Government, 1994.
8 *
9 *  This material may be reproduced by or for the U.S. Government pursuant
10 *  to the copyright license under the clause at DFARS 252.227-7013.  This
11 *  notice must appear in all copies of this file and its derivatives.
12 *
13 *  $Id$
14 */
15
16#include <rtems/system.h>
17#include <rtems/asr.h>
18#include <rtems/isr.h>
19#include <rtems/modes.h>
20#include <rtems/signal.h>
21#include <rtems/thread.h>
22
23/*PAGE
24 *
25 *  rtems_signal_catch
26 *
27 *  This directive allows a thread to specify what action to take when
28 *  catching signals.
29 *
30 *  Input parameters:
31 *    handler  - address of asynchronous signal routine (asr)
32 *              ( NULL indicates asr is invalid )
33 *    mode_set - mode value for asr
34 *
35 *  Output parameters:
36 *    RTEMS_SUCCESSFUL - always succeeds
37 */
38
39rtems_status_code rtems_signal_catch(
40  rtems_asr_entry   asr_handler,
41  rtems_mode        mode_set
42)
43{
44  Thread_Control *executing;
45
46/* XXX normalize mode */
47  executing = _Thread_Executing;
48  _Thread_Disable_dispatch(); /* cannot reschedule while */
49                              /*   the thread is inconsistent */
50
51  if ( !_ASR_Is_null_handler( asr_handler ) ) {
52    executing->RTEMS_API->Signal.mode_set = mode_set;
53    executing->RTEMS_API->Signal.handler  = asr_handler;
54  }
55  else
56    _ASR_Initialize( &executing->RTEMS_API->Signal );
57  _Thread_Enable_dispatch();
58  return( RTEMS_SUCCESSFUL );
59}
60
61/*PAGE
62 *
63 *  rtems_signal_send
64 *
65 *  This directive allows a thread to send signals to a thread.
66 *
67 *  Input parameters:
68 *    id         - thread id
69 *    signal_set - signal set
70 *
71 *  Output parameters:
72 *    RTEMS_SUCCESSFUL - if successful
73 *    error code - if unsuccessful
74 */
75
76rtems_status_code rtems_signal_send(
77  Objects_Id             id,
78  rtems_signal_set signal_set
79)
80{
81  register Thread_Control *the_thread;
82  Objects_Locations        location;
83
84  the_thread = _Thread_Get( id, &location );
85  switch ( location ) {
86    case OBJECTS_ERROR:
87      return( RTEMS_INVALID_ID );
88    case OBJECTS_REMOTE:
89      return _Signal_MP_Send_request_packet(
90        SIGNAL_MP_SEND_REQUEST,
91        id,
92        signal_set
93      );
94    case OBJECTS_LOCAL:
95      if ( ! _ASR_Is_null_handler( the_thread->RTEMS_API->Signal.handler ) ) {
96        if ( _Modes_Is_asr_disabled( the_thread->current_modes ) )
97          _ASR_Post_signals(
98            signal_set, &the_thread->RTEMS_API->Signal.signals_pending );
99        else {
100          _ASR_Post_signals(
101            signal_set, &the_thread->RTEMS_API->Signal.signals_posted );
102          if ( _ISR_Is_in_progress() && _Thread_Is_executing( the_thread ) )
103            _ISR_Signals_to_thread_executing = TRUE;
104        }
105        _Thread_Enable_dispatch();
106        return( RTEMS_SUCCESSFUL );
107      }
108      _Thread_Enable_dispatch();
109      return( RTEMS_NOT_DEFINED );
110  }
111
112  return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
113}
Note: See TracBrowser for help on using the repository browser.