4.115
Last change
on this file since c499856 was
c499856,
checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47
|
Change all references of rtems.com to rtems.org.
|
-
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.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <rtems/rtems/eventimpl.h> |
---|
22 | #include <rtems/rtems/tasks.h> |
---|
23 | #include <rtems/score/statesimpl.h> |
---|
24 | #include <rtems/score/threaddispatch.h> |
---|
25 | |
---|
26 | rtems_status_code rtems_event_receive( |
---|
27 | rtems_event_set event_in, |
---|
28 | rtems_option option_set, |
---|
29 | rtems_interval ticks, |
---|
30 | rtems_event_set *event_out |
---|
31 | ) |
---|
32 | { |
---|
33 | rtems_status_code sc; |
---|
34 | |
---|
35 | if ( event_out != NULL ) { |
---|
36 | Thread_Control *executing = _Thread_Get_executing(); |
---|
37 | RTEMS_API_Control *api = executing->API_Extensions[ THREAD_API_RTEMS ]; |
---|
38 | Event_Control *event = &api->Event; |
---|
39 | |
---|
40 | if ( !_Event_sets_Is_empty( event_in ) ) { |
---|
41 | _Thread_Disable_dispatch(); |
---|
42 | _Event_Seize( |
---|
43 | event_in, |
---|
44 | option_set, |
---|
45 | ticks, |
---|
46 | event_out, |
---|
47 | executing, |
---|
48 | event, |
---|
49 | &_Event_Sync_state, |
---|
50 | STATES_WAITING_FOR_EVENT |
---|
51 | ); |
---|
52 | _Thread_Enable_dispatch(); |
---|
53 | |
---|
54 | sc = executing->Wait.return_code; |
---|
55 | } else { |
---|
56 | *event_out = event->pending_events; |
---|
57 | sc = RTEMS_SUCCESSFUL; |
---|
58 | } |
---|
59 | } else { |
---|
60 | sc = RTEMS_INVALID_ADDRESS; |
---|
61 | } |
---|
62 | |
---|
63 | return sc; |
---|
64 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.