source: rtems/c/src/exec/rtems/headers/event.h @ 7f6fab6

4.104.114.84.95
Last change on this file since 7f6fab6 was 7f6fab6, checked in by Joel Sherrill <joel.sherrill@…>, on 12/01/95 at 19:28:52

Made _Event_Sync volatile

Replaced critical section algorithm to correct race conditions.
This resulted in the new variable _Event_Sync_state and the type
_Event_Sync_states.

  • Property mode set to 100644
File size: 4.3 KB
RevLine 
[ac7d5ef0]1/*  event.h
2 *
3 *  This include file contains the information pertaining to the Event
4 *  Manager.  This manager provides a high performance method of communication
5 *  and synchronization.
6 *
7 *  Directives provided are:
8 *
9 *     + send an event set to a task
10 *     + receive event condition
11 *
12 *
13 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
14 *  On-Line Applications Research Corporation (OAR).
15 *  All rights assigned to U.S. Government, 1994.
16 *
17 *  This material may be reproduced by or for the U.S. Government pursuant
18 *  to the copyright license under the clause at DFARS 252.227-7013.  This
19 *  notice must appear in all copies of this file and its derivatives.
20 *
21 *  $Id$
22 */
23
24#ifndef __RTEMS_EVENT_h
25#define __RTEMS_EVENT_h
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
[5e9b32b]31#include <rtems/score/object.h>
[3a4ae6c]32#include <rtems/rtems/types.h>
33#include <rtems/rtems/options.h>
[5e9b32b]34#include <rtems/score/thread.h>
35#include <rtems/score/watchdog.h>
[3a4ae6c]36#include <rtems/rtems/eventset.h>
[ac7d5ef0]37
38/*
39 *  This constant is passed as the event_in to the
40 *  rtems_event_receive directive to determine which events are pending.
41 */
42
43#define EVENT_CURRENT  0
44
[7f6fab6]45/*
46 *  The following enumerated types indicate what happened while the event
47 *  manager was in the synchronization window.
48 */
49
50typedef enum {
51  EVENT_SYNC_NOTHING_HAPPENED,
52  EVENT_SYNC_TIMEOUT,
53  EVENT_SYNC_SATISFIED
54}  Event_Sync_states;
55 
56
[ac7d5ef0]57/*
58 *  _Event_Manager_initialization
59 *
60 *  DESCRIPTION:
61 *
62 *  This routine performs the initialization necessary for this manager.
63 */
64
65STATIC INLINE void _Event_Manager_initialization( void );
66
67/*
68 *  rtems_event_send
69 *
70 *  DESCRIPTION:
71 *
72 *  This routine implements the rtems_event_send directive.  It sends
73 *  event_in to the task specified by ID.  If the task is blocked
74 *  waiting to receive events and the posting of event_in satisfies
75 *  the task's event condition, then it is unblocked.
76 */
77
78rtems_status_code rtems_event_send (
79  Objects_Id         id,
80  rtems_event_set event_in
81);
82
83/*
84 *  rtems_event_receive
85 *
86 *  DESCRIPTION:
87 *
88 *  This routine implements the rtems_event_receive directive.  This
89 *  directive is invoked when the calling task wishes to receive
90 *  the event_in event condition.  One of the fields in the option_set
91 *  parameter determines whether the receive request is satisfied if
92 *  any or all of the events are pending.   If the event condition
93 *  is not satisfied immediately, then the task may block with an
94 *  optional timeout of TICKS clock ticks or return immediately.
95 *  This determination is based on another field in the option_set
96 *  parameter.  This directive returns the events received in the
97 *  event_out parameter.
98 */
99
100rtems_status_code rtems_event_receive (
101  rtems_event_set  event_in,
102  rtems_option     option_set,
103  rtems_interval   ticks,
104  rtems_event_set *event_out
105);
106
107/*
108 *  _Event_Seize
109 *
110 *  DESCRIPTION:
111 *
112 *  This routine determines if the event condition event_in is
113 *  satisfied.  If so or if the no_wait option is enabled in option_set,
114 *  then the procedure returns immediately.  If neither of these
115 *  conditions is true, then the calling task is blocked with an
116 *  optional timeout of ticks clock ticks.
117 */
118
119void _Event_Seize (
[3a4ae6c]120  rtems_event_set  event_in,
121  rtems_option     option_set,
122  rtems_interval   ticks,
123  rtems_event_set *event_out
[ac7d5ef0]124);
125
126/*
127 *  _Event_Surrender
128 *
129 *  DESCRIPTION:
130 *
131 *  This routine determines if the event condition of the_thread
132 *  has been satisfied.  If so, it unblocks the_thread.
133 */
134
135void _Event_Surrender (
136  Thread_Control *the_thread
137);
138
139/*
140 *  _Event_Timeout
141 *
142 *  DESCRIPTION:
143 *
144 *  This routine is invoked when a task's event receive request
145 *  has not been satisfied after the specified timeout interval.
146 *  The task represented by ID will be unblocked and its status
147 *  code will be set in it's control block to indicate that a timeout
148 *  has occurred.
149 */
150
151void _Event_Timeout (
152  Objects_Id  id,
153  void       *ignored
154);
155
156/*
[7f6fab6]157 *  The following defines the synchronization flags used by the
[ac7d5ef0]158 *  Event Manager to insure that signals sent to the currently
159 *  executing thread are received properly.
160 */
161
[7f6fab6]162EXTERN volatile boolean _Event_Sync;
163EXTERN volatile Event_Sync_states _Event_Sync_state;
[ac7d5ef0]164
[3a4ae6c]165#include <rtems/rtems/eventmp.h>
166#include <rtems/rtems/event.inl>
[ac7d5ef0]167
168#ifdef __cplusplus
169}
170#endif
171
172#endif
173/* end of include file */
Note: See TracBrowser for help on using the repository browser.