Skip to content

Commit a5c49be

Browse files
committed
zephyr-core: k_poll_signal: helper to test readiness
1 parent a4f2337 commit a5c49be

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

rust/zephyr-core/src/poll.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use libc::{c_int, c_void};
22
use zephyr_sys::raw::{
33
_poll_types_bits__POLL_TYPE_SEM_AVAILABLE, _poll_types_bits__POLL_TYPE_SIGNAL, k_poll_event,
4-
k_poll_modes_K_POLL_MODE_NOTIFY_ONLY, K_POLL_TYPE_IGNORE,
4+
k_poll_modes_K_POLL_MODE_NOTIFY_ONLY, K_POLL_STATE_NOT_READY, K_POLL_TYPE_IGNORE,
55
};
66

77
use crate::kobj::*;
@@ -34,6 +34,8 @@ pub trait PollEventFuncs {
3434
fn new() -> Self;
3535

3636
fn init<'e, 'o: 'e, O: PollableKobj>(&'e mut self, kobj: &'o O, mode: PollMode);
37+
38+
fn ready(&self) -> bool;
3739
}
3840

3941
impl PollEventFuncs for KPollEvent {
@@ -60,6 +62,10 @@ impl PollEventFuncs for KPollEvent {
6062
)
6163
}
6264
}
65+
66+
fn ready(&self) -> bool {
67+
self.state() != K_POLL_STATE_NOT_READY
68+
}
6369
}
6470

6571
pub trait PollSyscalls {

0 commit comments

Comments
 (0)