source: rtems/c/src/exec/rtems/src/signalcatch.c @ 0123e3b

4.104.114.84.95
Last change on this file since 0123e3b was 0123e3b, checked in by Joel Sherrill <joel.sherrill@…>, on 05/17/99 at 23:20:52

Split Signal Manager into one routine per file.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  Signal Manager
3 *
4 *
5 *  COPYRIGHT (c) 1989-1998.
6 *  On-Line Applications Research Corporation (OAR).
7 *  Copyright assigned to U.S. Government, 1994.
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.OARcorp.com/rtems/license.html.
12 *
13 *  $Id$
14 */
15
16#include <rtems/system.h>
17#include <rtems/rtems/status.h>
18#include <rtems/rtems/asr.h>
19#include <rtems/score/isr.h>
20#include <rtems/rtems/modes.h>
21#include <rtems/rtems/signal.h>
22#include <rtems/score/thread.h>
23#include <rtems/rtems/tasks.h>
24
25/*PAGE
26 *
27 *  rtems_signal_catch
28 *
29 *  This directive allows a thread to specify what action to take when
30 *  catching signals.
31 *
32 *  Input parameters:
33 *    handler  - address of asynchronous signal routine (asr)
34 *              ( NULL indicates asr is invalid )
35 *    mode_set - mode value for asr
36 *
37 *  Output parameters:
38 *    RTEMS_SUCCESSFUL - always succeeds
39 */
40
41rtems_status_code rtems_signal_catch(
42  rtems_asr_entry   asr_handler,
43  rtems_mode        mode_set
44)
45{
46  Thread_Control     *executing;
47  RTEMS_API_Control  *api;
48  ASR_Information    *asr;
49
50/* XXX normalize mode */
51  executing = _Thread_Executing;
52  api = executing->API_Extensions[ THREAD_API_RTEMS ];
53  asr = &api->Signal;
54
55  _Thread_Disable_dispatch(); /* cannot reschedule while */
56                              /*   the thread is inconsistent */
57
58  if ( !_ASR_Is_null_handler( asr_handler ) ) {
59    asr->mode_set = mode_set;
60    asr->handler = asr_handler;
61  }
62  else
63    _ASR_Initialize( asr );
64  _Thread_Enable_dispatch();
65  return RTEMS_SUCCESSFUL;
66}
Note: See TracBrowser for help on using the repository browser.