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.OARcorp.com/rtems/license.html. |
---|
10 | * |
---|
11 | * $Id$ |
---|
12 | */ |
---|
13 | |
---|
14 | #include <rtems/system.h> |
---|
15 | #include <rtems/rtems/status.h> |
---|
16 | #include <rtems/rtems/event.h> |
---|
17 | #include <rtems/score/isr.h> |
---|
18 | #include <rtems/score/object.h> |
---|
19 | #include <rtems/rtems/options.h> |
---|
20 | #include <rtems/score/states.h> |
---|
21 | #include <rtems/score/thread.h> |
---|
22 | #include <rtems/rtems/tasks.h> |
---|
23 | |
---|
24 | /*PAGE |
---|
25 | * |
---|
26 | * rtems_event_receive |
---|
27 | * |
---|
28 | * This directive allows a thread to receive a set of events. |
---|
29 | * |
---|
30 | * Input parameters: |
---|
31 | * event_in - input event condition |
---|
32 | * option_set - options |
---|
33 | * ticks - number of ticks to wait (0 means wait forever) |
---|
34 | * event_out - pointer to output event set |
---|
35 | * |
---|
36 | * Output parameters: |
---|
37 | * event out - event set |
---|
38 | * RTEMS_SUCCESSFUL - if successful |
---|
39 | * error code - if unsuccessful |
---|
40 | */ |
---|
41 | |
---|
42 | rtems_status_code rtems_event_receive( |
---|
43 | rtems_event_set event_in, |
---|
44 | rtems_option option_set, |
---|
45 | rtems_interval ticks, |
---|
46 | rtems_event_set *event_out |
---|
47 | ) |
---|
48 | { |
---|
49 | RTEMS_API_Control *api; |
---|
50 | |
---|
51 | api = _Thread_Executing->API_Extensions[ THREAD_API_RTEMS ]; |
---|
52 | |
---|
53 | if ( _Event_sets_Is_empty( event_in ) ) { |
---|
54 | *event_out = api->pending_events; |
---|
55 | return RTEMS_SUCCESSFUL; |
---|
56 | } |
---|
57 | |
---|
58 | _Thread_Disable_dispatch(); |
---|
59 | _Event_Seize( event_in, option_set, ticks, event_out ); |
---|
60 | _Thread_Enable_dispatch(); |
---|
61 | return( _Thread_Executing->Wait.return_code ); |
---|
62 | } |
---|