source: rtems/cpukit/rtems/src/signalcatch.c @ eaef4657

4.104.115
Last change on this file since eaef4657 was 1095ec1, checked in by Ralf Corsepius <ralf.corsepius@…>, on 01/18/05 at 09:03:45

Include config.h.

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