source: rtems/cpukit/rtems/src/signalsend.c @ 7feb6f9

Last change on this file since 7feb6f9 was 7feb6f9, checked in by Joel Sherrill <joel.sherrill@…>, on 07/24/04 at 17:08:17

2004-07-24 Joel Sherrill <joel@…>

PR rtems/652

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