source: rtems/cpukit/rtems/src/systemeventsend.c @ 7d6e94b

4.115
Last change on this file since 7d6e94b was 7d6e94b, checked in by Sebastian Huber <sebastian.huber@…>, on 03/04/15 at 07:02:19

score: Implement fine-grained locking for events

Use the ISR lock of the thread object to protect the event state and
use the Giant lock only for the blocking operations.

Update #2273.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ClassicEventSystem
5 *
6 * @brief rtems_event_system_send() implementation.
7 */
8
9/*
10 * Copyright (c) 2012 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Obere Lagerstr. 30
14 *  82178 Puchheim
15 *  Germany
16 *  <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.org/license/LICENSE.
21 */
22
23#if HAVE_CONFIG_H
24  #include "config.h"
25#endif
26
27#include <rtems/rtems/eventimpl.h>
28#include <rtems/rtems/tasks.h>
29#include <rtems/score/threadimpl.h>
30
31rtems_status_code rtems_event_system_send(
32  rtems_id        id,
33  rtems_event_set event_in
34)
35{
36  rtems_status_code  sc;
37  Thread_Control    *thread;
38  Objects_Locations  location;
39  RTEMS_API_Control *api;
40  ISR_lock_Context   lock_context;
41
42  thread = _Thread_Acquire( id, &location, &lock_context );
43  switch ( location ) {
44    case OBJECTS_LOCAL:
45      api = thread->API_Extensions[ THREAD_API_RTEMS ];
46      _Event_Surrender(
47        thread,
48        event_in,
49        &api->System_event,
50        THREAD_WAIT_CLASS_SYSTEM_EVENT,
51        &lock_context
52      );
53      sc = RTEMS_SUCCESSFUL;
54      break;
55#ifdef RTEMS_MULTIPROCESSING
56    case OBJECTS_REMOTE:
57      _Thread_Dispatch();
58      sc = RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
59      break;
60#endif
61    default:
62      sc = RTEMS_INVALID_ID;
63      break;
64  }
65
66  return sc;
67}
Note: See TracBrowser for help on using the repository browser.