Lines Matching refs:events
32 **poll events**, one for each condition.
34 All events in the array must be initialized before the array can be polled on.
45 Each event can optionally specify a **tag** to group multiple events together,
55 nature of the kernel. The caller must look at the state of all the poll events
72 The main API is :c:func:`k_poll`, which operates on an array of poll events
77 Poll events can be initialized using either the runtime initializers
84 there to help a user to group similar events together. Being optional, it is
93 struct k_poll_event events[4] = {
112 struct k_poll_event events[4];
115 k_poll_event_init(&events[0],
120 k_poll_event_init(&events[1],
125 k_poll_event_init(&events[2],
130 k_poll_event_init(&events[3],
139 After the events are initialized, the array can be passed to
145 A list of pollers is offered on each semaphore or FIFO and as many events
160 rc = k_poll(events, ARRAY_SIZE(events), K_MSEC(1000));
162 if (events[0].state == K_POLL_STATE_SEM_AVAILABLE) {
163 k_sem_take(events[0].sem, 0);
164 } else if (events[1].state == K_POLL_STATE_FIFO_DATA_AVAILABLE) {
165 data = k_fifo_get(events[1].fifo, 0);
167 } else if (events[2].state == K_POLL_STATE_MSGQ_DATA_AVAILABLE) {
168 ret = k_msgq_get(events[2].msgq, buf, K_NO_WAIT);
170 } else if (events[3].state == K_POLL_STATE_PIPE_DATA_AVAILABLE) {
171 … ret = k_pipe_get(events[3].pipe, buf, bytes_to_read, &bytes_read, min_xfer, K_NO_WAIT);
179 When :c:func:`k_poll` is called in a loop, the events state must be reset
187 rc = k_poll(events, ARRAY_SIZE(events), K_FOREVER);
188 if (events[0].state == K_POLL_STATE_SEM_AVAILABLE) {
189 k_sem_take(events[0].sem, 0);
191 if (events[1].state == K_POLL_STATE_FIFO_DATA_AVAILABLE) {
192 data = k_fifo_get(events[1].fifo, 0);
195 if (events[2].state == K_POLL_STATE_MSGQ_DATA_AVAILABLE) {
196 ret = k_msgq_get(events[2].msgq, buf, K_NO_WAIT);
199 if (events[3].state == K_POLL_STATE_PIPE_DATA_AVAILABLE) {
200 … ret = k_pipe_get(events[3].pipe, buf, bytes_to_read, &bytes_read, min_xfer, K_NO_WAIT);
203 events[0].state = K_POLL_STATE_NOT_READY;
204 events[1].state = K_POLL_STATE_NOT_READY;
205 events[2].state = K_POLL_STATE_NOT_READY;
206 events[3].state = K_POLL_STATE_NOT_READY;
213 One of the types of events is :c:macro:`K_POLL_TYPE_SIGNAL`: this is a "direct"
243 struct k_poll_event events[1] = {
249 k_poll(events, 1, K_FOREVER);
280 struct k_poll_event events[1] = {
287 k_poll(events, 1, K_FOREVER);
300 events[0].state = K_POLL_STATE_NOT_READY;
310 application will miss events. Best practice is always to reset the
314 events, architecturally.