Class ActionQueue

Inheritance Relationships

Base Type

Class Documentation

class ActionQueue : public mir::dispatch::Dispatchable

Public Functions

ActionQueue()
virtual Fd watch_fd() const override

Get a poll()able file descriptor.

Returns:

A file descriptor usable with poll() or equivalent function calls. relevant_events() contains the set of event types to watch for.

void enqueue(std::function<void()> const &action)
virtual bool dispatch(FdEvents events) override

Dispatch one pending event.

Parameters:

events[in] 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.

Note

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.

Note

An implementation of dispatch() MUST handle FdEvent::error, if only to return false and terminate further event dispatch.

virtual FdEvents relevant_events() const override

The set of file-descriptor events this Dispatchable handles.