source: rtems/cpukit/rtems/src/signalsend.c @ 11e8bc5

4.115
Last change on this file since 11e8bc5 was 11e8bc5, checked in by Joel Sherrill <joel.sherrill@…>, on 06/29/10 at 00:34:12

2010-06-28 Joel Sherrill <joel.sherrill@…>

PR 1573/cpukit

  • configure.ac, posix/src/killinfo.c, posix/src/psignalclearprocesssignals.c, posix/src/psignalsetprocesssignals.c, posix/src/psignalunblockthread.c, posix/src/pthreadcreate.c, posix/src/pthreadkill.c, posix/src/pthreadsigmask.c, rtems/src/signalsend.c, rtems/src/taskmode.c, score/Makefile.am, score/preinstall.am, score/include/rtems/system.h, score/include/rtems/score/context.h, score/include/rtems/score/isr.h, score/include/rtems/score/thread.h, score/src/isr.c, score/src/isrthreaddispatch.c, score/src/thread.c, score/src/threaddispatch.c, score/src/threadloadenv.c: Add a per cpu data structure which contains the information required by RTEMS for each CPU core. This encapsulates information such as thread executing, heir, idle and dispatch needed.
  • score/include/rtems/score/percpu.h, score/src/percpu.c: New files.
  • 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  rtems_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          if ( _ISR_Is_in_progress() && _Thread_Is_executing( the_thread ) )
68            _Context_Switch_necessary = true;
69        } else {
70          _ASR_Post_signals( signal_set, &asr->signals_pending );
71        }
72        _Thread_Enable_dispatch();
73        return RTEMS_SUCCESSFUL;
74      }
75      _Thread_Enable_dispatch();
76      return RTEMS_NOT_DEFINED;
77
78#if defined(RTEMS_MULTIPROCESSING)
79    case OBJECTS_REMOTE:
80      return _Signal_MP_Send_request_packet(
81        SIGNAL_MP_SEND_REQUEST,
82        id,
83        signal_set
84      );
85#endif
86
87    case OBJECTS_ERROR:
88      break;
89  }
90
91  return RTEMS_INVALID_ID;
92}
Note: See TracBrowser for help on using the repository browser.