source: rtems/cpukit/rtems/src/signalsend.c @ 6b5f22dc

Last change on this file since 6b5f22dc was 6b5f22dc, checked in by Sebastian Huber <sebastian.huber@…>, on 11/26/20 at 10:45:47

rtems: Canonicalize Doxygen @file comments

Use common phrases for the file brief descriptions.

Update #3706.

  • Property mode set to 100644
File size: 1.9 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup RTEMSImplClassicSignal
5 *
6 * @brief This source file contains the implementation of
7 *   rtems_signal_send().
8 */
9
10/*
11 *  COPYRIGHT (c) 1989-2014.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.org/license/LICENSE.
17 */
18
19#ifdef HAVE_CONFIG_H
20#include "config.h"
21#endif
22
23#include <rtems/rtems/signalimpl.h>
24#include <rtems/rtems/asrimpl.h>
25#include <rtems/rtems/tasksdata.h>
26#include <rtems/score/threaddispatch.h>
27#include <rtems/score/threadimpl.h>
28
29rtems_status_code rtems_signal_send(
30  rtems_id          id,
31  rtems_signal_set  signal_set
32)
33{
34  Thread_Control    *the_thread;
35  ISR_lock_Context   lock_context;
36  RTEMS_API_Control *api;
37  ASR_Information   *asr;
38
39  if ( signal_set == 0 ) {
40    return RTEMS_INVALID_NUMBER;
41  }
42
43  the_thread = _Thread_Get( id, &lock_context );
44
45  if ( the_thread == NULL ) {
46#if defined(RTEMS_MULTIPROCESSING)
47    return _Signal_MP_Send( id, signal_set );
48#else
49    return RTEMS_INVALID_ID;
50#endif
51  }
52
53  api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
54  asr = &api->Signal;
55
56  _Thread_State_acquire_critical( the_thread, &lock_context );
57
58  if ( asr->handler == NULL ) {
59    _Thread_State_release( the_thread, &lock_context );
60    return RTEMS_NOT_DEFINED;
61  }
62
63  if ( asr->is_enabled ) {
64    Per_CPU_Control *cpu_self;
65
66    _ASR_Post_signals( signal_set, &asr->signals_posted );
67    _Thread_Add_post_switch_action(
68      the_thread,
69      &api->Signal_action,
70      _Signal_Action_handler
71    );
72    cpu_self = _Thread_Dispatch_disable_critical( &lock_context );
73    _Thread_State_release( the_thread, &lock_context );
74    _Thread_Dispatch_enable( cpu_self );
75  } else {
76    _ASR_Post_signals( signal_set, &asr->signals_pending );
77    _Thread_State_release( the_thread, &lock_context );
78  }
79
80  return RTEMS_SUCCESSFUL;
81}
Note: See TracBrowser for help on using the repository browser.