source: rtems/cpukit/rtems/src/eventreceive.c @ 4c90eb4

4.115
Last change on this file since 4c90eb4 was 4c90eb4, checked in by Mathew Kallada <matkallada@…>, on 12/08/12 at 13:48:37

misc rtems: Clean up Doxygen GCI Task #8

http://www.google-melange.com/gci/task/view/google/gci2012/8024203

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/**
2 * @file
3 *
4 * @brief  Constant used to receive the set of currently pending events in
5 * @ingroup ClassicEventSet Event Set
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-1999.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18  #include "config.h"
19#endif
20
21#include <rtems/rtems/event.h>
22#include <rtems/rtems/tasks.h>
23
24rtems_status_code rtems_event_receive(
25  rtems_event_set  event_in,
26  rtems_option     option_set,
27  rtems_interval   ticks,
28  rtems_event_set *event_out
29)
30{
31  rtems_status_code sc;
32
33  if ( event_out != NULL ) {
34    Thread_Control    *executing = _Thread_Executing;
35    RTEMS_API_Control *api = executing->API_Extensions[ THREAD_API_RTEMS ];
36    Event_Control     *event = &api->Event;
37
38    if ( !_Event_sets_Is_empty( event_in ) ) {
39      _Thread_Disable_dispatch();
40      _Event_Seize(
41        event_in,
42        option_set,
43        ticks,
44        event_out,
45        executing,
46        event,
47        &_Event_Sync_state,
48        STATES_WAITING_FOR_EVENT
49      );
50      _Thread_Enable_dispatch();
51
52      sc = executing->Wait.return_code;
53    } else {
54      *event_out = event->pending_events;
55      sc = RTEMS_SUCCESSFUL;
56    }
57  } else {
58    sc = RTEMS_INVALID_ADDRESS;
59  }
60
61  return sc;
62}
Note: See TracBrowser for help on using the repository browser.