source: rtems/cpukit/rtems/src/eventreceive.c @ eaef4657

4.104.115
Last change on this file since eaef4657 was 1095ec1, checked in by Ralf Corsepius <ralf.corsepius@…>, on 01/18/05 at 09:03:45

Include config.h.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  Event Manager
3 *
4 *  COPYRIGHT (c) 1989-1999.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <rtems/system.h>
19#include <rtems/rtems/status.h>
20#include <rtems/rtems/event.h>
21#include <rtems/score/isr.h>
22#include <rtems/score/object.h>
23#include <rtems/rtems/options.h>
24#include <rtems/score/states.h>
25#include <rtems/score/thread.h>
26#include <rtems/rtems/tasks.h>
27
28/*PAGE
29 *
30 *  rtems_event_receive
31 *
32 *  This directive allows a thread to receive a set of events.
33 *
34 *  Input parameters:
35 *    event_in   - input event condition
36 *    option_set - options
37 *    ticks      - number of ticks to wait (0 means wait forever)
38 *    event_out  - pointer to output event set
39 *
40 *  Output parameters:
41 *    event out         - event set
42 *    RTEMS_SUCCESSFUL - if successful
43 *    error code        - if unsuccessful
44 */
45
46rtems_status_code rtems_event_receive(
47  rtems_event_set  event_in,
48  rtems_option     option_set,
49  rtems_interval   ticks,
50  rtems_event_set *event_out
51)
52{
53  RTEMS_API_Control       *api;
54
55  if ( !event_out )
56    return RTEMS_INVALID_ADDRESS;
57
58  api = _Thread_Executing->API_Extensions[ THREAD_API_RTEMS ];
59
60  if ( _Event_sets_Is_empty( event_in ) ) {
61    *event_out = api->pending_events;
62    return RTEMS_SUCCESSFUL;
63  }
64
65  _Thread_Disable_dispatch();
66  _Event_Seize( event_in, option_set, ticks, event_out );
67  _Thread_Enable_dispatch();
68  return( _Thread_Executing->Wait.return_code );
69}
Note: See TracBrowser for help on using the repository browser.