An adaptor that combines multiple Dispatchables into a single Dispatchable.
More...
#include <multiplexing_dispatchable.h>
An adaptor that combines multiple Dispatchables into a single Dispatchable.
- Note
- Instances are fully thread-safe.
◆ MultiplexingDispatchable() [1/3]
mir::dispatch::MultiplexingDispatchable::MultiplexingDispatchable |
( |
| ) |
|
◆ MultiplexingDispatchable() [2/3]
mir::dispatch::MultiplexingDispatchable::MultiplexingDispatchable |
( |
std::initializer_list< std::shared_ptr< Dispatchable >> |
dispatchees | ) |
|
◆ ~MultiplexingDispatchable()
virtual mir::dispatch::MultiplexingDispatchable::~MultiplexingDispatchable |
( |
| ) |
|
|
virtualnoexcept |
◆ MultiplexingDispatchable() [3/3]
◆ add_watch() [1/3]
void mir::dispatch::MultiplexingDispatchable::add_watch |
( |
std::shared_ptr< Dispatchable > const & |
dispatchee | ) |
|
Add a dispatchable to the adaptor.
- Parameters
-
◆ add_watch() [2/3]
Add a dispatchable to the adaptor, specifying the reentrancy of dispatch()
◆ add_watch() [3/3]
void mir::dispatch::MultiplexingDispatchable::add_watch |
( |
Fd const & |
fd, |
|
|
std::function< void()> const & |
callback |
|
) |
| |
Add a simple callback to the adaptor.
- Parameters
-
[in] | fd | File descriptor to monitor for readability |
[in] | callback | Callback to fire when fd becomes readable. This callback is not called reentrantly. |
◆ dispatch()
bool mir::dispatch::MultiplexingDispatchable::dispatch |
( |
FdEvents |
events | ) |
|
|
overridevirtual |
Dispatch one pending event.
- Parameters
-
[in] | events | The set of events current on the file-descriptor |
- Returns
- False iff no more events will be produced by this Dispatchable. Dispatch should no longer be called.
- Note
- This will dispatch at most one event. If there are multiple events specified in
events
(eg: readable | remote_closed) then dispatch will process only one.
-
It is harmless to call dispatch() with an event that does not contain any of the events from relevant_events(). The function will do nothing in such a case.
-
An implementation of dispatch() MUST handle FdEvent::error, if only to return false and terminate further event dispatch.
Implements mir::dispatch::Dispatchable.
◆ operator=()
◆ relevant_events()
FdEvents mir::dispatch::MultiplexingDispatchable::relevant_events |
( |
| ) |
const |
|
overridevirtual |
◆ remove_watch() [1/2]
void mir::dispatch::MultiplexingDispatchable::remove_watch |
( |
std::shared_ptr< Dispatchable > const & |
dispatchee | ) |
|
Remove a watch from the dispatchable.
- Parameters
-
◆ remove_watch() [2/2]
void mir::dispatch::MultiplexingDispatchable::remove_watch |
( |
Fd const & |
fd | ) |
|
Remove a watch by file-descriptor.
- Parameters
-
[in] | fd | File descriptor of watch to remove. |
◆ watch_fd()
Fd mir::dispatch::MultiplexingDispatchable::watch_fd |
( |
| ) |
const |
|
overridevirtual |
The documentation for this class was generated from the following file:
Copyright © 2012-2018
Canonical Ltd.
Generated on Thu Apr 5 15:26:05 UTC 2018