Struct wayland_server::EventLoop
[−]
[src]
pub struct EventLoop { /* fields omitted */ }
An event loop
This is an event loop primitive provided by the wayland C libraries. It is notably used for processing messages from the different clients of your server, but additionnal event sources can be associated to it.
You can also create other event loops (for a multithreaded server for example), however the wayland clients can only be processed from the original event loop created at the same time as the display.
The event loops cannot be moved accross threads, so make sure you create them on the thread you want to use them.
Methods
impl EventLoop
[src]
pub fn new() -> EventLoop
[src]
Create a new event loop
pub fn token(&self) -> LoopToken
[src]
Retrieve a LoopToken
associated to this event loop
pub fn signal(&self) -> LoopSignal
[src]
Retrieve a LoopSignal
associated to this event loop
pub fn dispatch(&mut self, timeout: Option<u32>) -> IoResult<u32>
[src]
Dispatch pending requests to their respective handlers
If no request is pending, will block at most timeout
ms if specified,
or indefinitely if timeout
is None
.
Returns the number of requests dispatched or an error.
pub fn run(&mut self) -> IoResult<()>
[src]
Runs the event loop
This method will call repetitively the dispatch method,
until one of the handlers call the stop
method of an associated
LoopSignal
.
If this event loop is attached to a display, it will also
flush the events to the clients between two calls to
dispatch()
.
Note that this method will block indefinitely on waiting events,
as such, if you need to avoid a complete block even if no events
are received, you should use the dispatch()
method instead and
set a timeout.