Struct ndk::looper::ThreadLooper
source · pub struct ThreadLooper { /* private fields */ }Expand description
A thread-local native ALooper *. This promises that there is a looper associated with the
current thread.
Implementations§
source§impl ThreadLooper
impl ThreadLooper
sourcepub fn for_thread() -> Option<Self>
pub fn for_thread() -> Option<Self>
Returns the looper associated with the current thread, if any.
sourcepub fn poll_once(&self) -> Result<Poll<'_>, LooperError>
pub fn poll_once(&self) -> Result<Poll<'_>, LooperError>
Polls the looper, blocking on processing an event.
sourcepub fn poll_once_timeout(
&self,
timeout: Duration
) -> Result<Poll<'_>, LooperError>
pub fn poll_once_timeout( &self, timeout: Duration ) -> Result<Poll<'_>, LooperError>
Polls the looper, blocking on processing an event, but with a timeout. Give a timeout of
Duration::ZERO to make this non-blocking.
It panics if the timeout is larger than expressible as an i32 of milliseconds (roughly 25
days).
sourcepub fn poll_all(&self) -> Result<Poll<'_>, LooperError>
pub fn poll_all(&self) -> Result<Poll<'_>, LooperError>
Repeatedly polls the looper, blocking on processing an event.
This function will never return Poll::Callback.
sourcepub fn poll_all_timeout(
&self,
timeout: Duration
) -> Result<Poll<'_>, LooperError>
pub fn poll_all_timeout( &self, timeout: Duration ) -> Result<Poll<'_>, LooperError>
Repeatedly polls the looper, blocking on processing an event, but with a timeout. Give a
timeout of Duration::ZERO to make this non-blocking.
This function will never return Poll::Callback.
It panics if the timeout is larger than expressible as an i32 of milliseconds (roughly 25
days).
sourcepub fn as_foreign(&self) -> &ForeignLooper
pub fn as_foreign(&self) -> &ForeignLooper
Returns a reference to the ForeignLooper that is associated with the current thread.