source: rtems/cpukit/rtems/src/signalsend.c @ 484a769

4.104.114.9
Last change on this file since 484a769 was 484a769, checked in by Ralf Corsepius <ralf.corsepius@…>, on Sep 4, 2008 at 5:46:39 PM

Convert to "bool".

  • Property mode set to 100644
File size: 2.1 KB
Line 
1/*
2 *  Signal Manager
3 *
4 *
5 *  COPYRIGHT (c) 1989-2007.
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_send
31 *
32 *  This directive allows a thread to send signals to a thread.
33 *
34 *  Input parameters:
35 *    id         - thread id
36 *    signal_set - signal set
37 *
38 *  Output parameters:
39 *    RTEMS_SUCCESSFUL - if successful
40 *    error code       - if unsuccessful
41 */
42
43rtems_status_code rtems_signal_send(
44  Objects_Id        id,
45  rtems_signal_set  signal_set
46)
47{
48  register Thread_Control *the_thread;
49  Objects_Locations        location;
50  RTEMS_API_Control       *api;
51  ASR_Information         *asr;
52
53  if ( !signal_set )
54    return RTEMS_INVALID_NUMBER;
55
56  the_thread = _Thread_Get( id, &location );
57  switch ( location ) {
58
59    case OBJECTS_LOCAL:
60      api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
61      asr = &api->Signal;
62
63      if ( ! _ASR_Is_null_handler( asr->handler ) ) {
64        if ( asr->is_enabled ) {
65          _ASR_Post_signals( signal_set, &asr->signals_posted );
66
67          the_thread->do_post_task_switch_extension = true;
68
69          if ( _ISR_Is_in_progress() && _Thread_Is_executing( the_thread ) )
70            _ISR_Signals_to_thread_executing = TRUE;
71        } else {
72          _ASR_Post_signals( signal_set, &asr->signals_pending );
73        }
74        _Thread_Enable_dispatch();
75        return RTEMS_SUCCESSFUL;
76      }
77      _Thread_Enable_dispatch();
78      return RTEMS_NOT_DEFINED;
79
80#if defined(RTEMS_MULTIPROCESSING)
81    case OBJECTS_REMOTE:
82      return _Signal_MP_Send_request_packet(
83        SIGNAL_MP_SEND_REQUEST,
84        id,
85        signal_set
86      );
87#endif
88
89    case OBJECTS_ERROR:
90      break;
91  }
92
93  return RTEMS_INVALID_ID;
94}
Note: See TracBrowser for help on using the repository browser.