source: rtems/cpukit/rtems/src/signalsend.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: 2.1 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_send
28 *
29 *  This directive allows a thread to send signals to a thread.
30 *
31 *  Input parameters:
32 *    id         - thread id
33 *    signal_set - signal set
34 *
35 *  Output parameters:
36 *    RTEMS_SUCCESSFUL - if successful
37 *    error code - if unsuccessful
38 */
39
40rtems_status_code rtems_signal_send(
41  Objects_Id             id,
42  rtems_signal_set signal_set
43)
44{
45  register Thread_Control *the_thread;
46  Objects_Locations        location;
47  RTEMS_API_Control       *api;
48  ASR_Information         *asr;
49
50  the_thread = _Thread_Get( id, &location );
51  switch ( location ) {
52
53    case OBJECTS_REMOTE:
54#if defined(RTEMS_MULTIPROCESSING)
55      return _Signal_MP_Send_request_packet(
56        SIGNAL_MP_SEND_REQUEST,
57        id,
58        signal_set
59      );
60#endif
61
62    case OBJECTS_ERROR:
63      return RTEMS_INVALID_ID;
64
65    case OBJECTS_LOCAL:
66      api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
67      asr = &api->Signal;
68
69      if ( ! _ASR_Is_null_handler( asr->handler ) ) {
70        if ( asr->is_enabled ) {
71          _ASR_Post_signals( signal_set, &asr->signals_posted );
72
73          the_thread->do_post_task_switch_extension = TRUE;
74
75          if ( _ISR_Is_in_progress() && _Thread_Is_executing( the_thread ) )
76            _ISR_Signals_to_thread_executing = TRUE;
77        } else {
78          _ASR_Post_signals( signal_set, &asr->signals_pending );
79        }
80        _Thread_Enable_dispatch();
81        return RTEMS_SUCCESSFUL;
82      }
83      _Thread_Enable_dispatch();
84      return RTEMS_NOT_DEFINED;
85  }
86
87  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
88}
Note: See TracBrowser for help on using the repository browser.