19 #ifndef MIR_DISPATCH_MULTIPLEXING_DISPATCHABLE_H_
20 #define MIR_DISPATCH_MULTIPLEXING_DISPATCHABLE_H_
25 #include <initializer_list>
71 void add_watch(std::shared_ptr<Dispatchable>
const& dispatchee);
83 void add_watch(
Fd const& fd, std::function<
void()>
const& callback);
89 void remove_watch(std::shared_ptr<Dispatchable>
const& dispatchee);
97 pthread_rwlock_t lifetime_mutex;
98 std::list<std::pair<std::shared_ptr<Dispatchable>,
bool>> dispatchee_holder;
104 #endif // MIR_DISPATCH_MULTIPLEXING_DISPATCHABLE_H_
All things Mir.
Definition: atomic_callback.h:25
DispatchReentrancy
How concurrent dispatch should be handled.
Definition: multiplexing_dispatchable.h:38
Fd watch_fd() const override
Get a poll()able file descriptor.
Definition: multiplexing_dispatchable.cpp:169
MultiplexingDispatchable()
Definition: multiplexing_dispatchable.cpp:117
FdEvents relevant_events() const override
The set of file-descriptor events this Dispatchable handles.
Definition: multiplexing_dispatchable.cpp:223
An adaptor that combines multiple Dispatchables into a single Dispatchable.
Definition: multiplexing_dispatchable.h:52
MultiplexingDispatchable & operator=(MultiplexingDispatchable const &)=delete
void add_watch(std::shared_ptr< Dispatchable > const &dispatchee)
Add a dispatchable to the adaptor.
The dispatch function may be called on multiple threads simultaneously.
bool dispatch(FdEvents events) override
Dispatch one pending event.
Definition: multiplexing_dispatchable.cpp:174
Definition: dispatchable.h:38
uint32_t FdEvents
Definition: dispatchable.h:36
virtual ~MultiplexingDispatchable() noexcept
Definition: multiplexing_dispatchable.cpp:155
The dispatch function is guaranteed not to be called while a thread is currently running it...
void remove_watch(std::shared_ptr< Dispatchable > const &dispatchee)
Remove a watch from the dispatchable.
Definition: multiplexing_dispatchable.cpp:272