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.
mir::dispatch::MultiplexingDispatchable::MultiplexingDispatchable |
( |
| ) |
|
mir::dispatch::MultiplexingDispatchable::MultiplexingDispatchable |
( |
std::initializer_list< std::shared_ptr< Dispatchable >> |
dispatchees | ) |
|
virtual mir::dispatch::MultiplexingDispatchable::~MultiplexingDispatchable |
( |
| ) |
|
|
virtualnoexcept |
void mir::dispatch::MultiplexingDispatchable::add_watch |
( |
std::shared_ptr< Dispatchable > const & |
dispatchee | ) |
|
Add a dispatchable to the adaptor.
- Parameters
-
Add a dispatchable to the adaptor, specifying the reentrancy of dispatch()
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. |
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.
FdEvents mir::dispatch::MultiplexingDispatchable::relevant_events |
( |
| ) |
const |
|
overridevirtual |
void mir::dispatch::MultiplexingDispatchable::remove_watch |
( |
std::shared_ptr< Dispatchable > const & |
dispatchee | ) |
|
Remove a watch from the dispatchable.
- Parameters
-
void mir::dispatch::MultiplexingDispatchable::remove_watch |
( |
Fd const & |
fd | ) |
|
Remove a watch by file-descriptor.
- Parameters
-
[in] | fd | File descriptor of watch to remove. |
Fd mir::dispatch::MultiplexingDispatchable::watch_fd |
( |
| ) |
const |
|
overridevirtual |
The documentation for this class was generated from the following file:
Copyright © 2012-2016 Canonical Ltd.
Generated on Wed May 10 10:41:27 UTC 2017