kernel/poll: fix registrations that were not always cleared
Poll events were getting registered even when polling conditions had already been met, but events with conditions met did not register and did not increment the number of events registered. This caused a possible discrepancy between the number of events registered and the position of the last event registered in the events array. As soon as one event condition is met, the next ones in the array should not get registered even if their condition is not met. This is what the code does now. Change-Id: Ibcc3b135ec9d3cf463beb9da3f641fec962b34bf Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
This commit is contained in:
parent
47503e30b2
commit
2014ff162e
1 changed files with 1 additions and 1 deletions
|
@ -198,7 +198,7 @@ int k_poll(struct k_poll_event *events, int num_events, int32_t timeout)
|
|||
if (is_condition_met(&events[ii], &state)) {
|
||||
set_event_ready(&events[ii], state);
|
||||
clear_polling_state(_current);
|
||||
} else if (timeout != K_NO_WAIT && !in_use) {
|
||||
} else if (timeout != K_NO_WAIT && is_polling() && !in_use) {
|
||||
rc = register_event(&events[ii]);
|
||||
if (rc == 0) {
|
||||
events[ii].poller = &poller;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue