Loading...
Searching...
No Matches
libcamera::EventDispatcherPoll Class Referencefinal

A poll-based event dispatcher. More...

Inheritance diagram for libcamera::EventDispatcherPoll:
[legend]
Collaboration diagram for libcamera::EventDispatcherPoll:
[legend]

## Public Member Functions

void | registerEventNotifier (EventNotifier *notifier)
| Register an event notifier.
void | unregisterEventNotifier (EventNotifier *notifier)
| Unregister an event notifier.
void | registerTimer (Timer *timer)
| Register a timer.
void | unregisterTimer (Timer *timer)
| Unregister a timer.
void | processEvents ()
| Wait for and process pending events.
void | interrupt ()
| Interrupt any running processEvents() call as soon as possible.

## Detailed Description

A poll-based event dispatcher.

## Member Function Documentation

## interrupt()

void libcamera::EventDispatcherPoll::interrupt | ( |  | ) |

virtual

Interrupt any running processEvents() call as soon as possible.

Calling this function interrupts any blocking processEvents() call in progress. The processEvents() function will return as soon as possible, after processing pending timers and events. If processEvents() isn't in progress, it will be interrupted immediately the next time it gets called.

Implements libcamera::EventDispatcher.

## processEvents()

void libcamera::EventDispatcherPoll::processEvents | ( |  | ) |

virtual

Wait for and process pending events.

This function processes all pending events associated with registered event notifiers and timers and signals the corresponding EventNotifier and Timer objects. If no events are pending, it waits for the first event and processes it before returning.

Implements libcamera::EventDispatcher.

## registerEventNotifier()

void libcamera::EventDispatcherPoll::registerEventNotifier | ( | EventNotifier * | notifier | ) |

virtual

Register an event notifier.

Parameters

  [in] | notifier | The event notifier to register

Once the notifier is registered with the dispatcher, the dispatcher will emit the notifier EventNotifier::activated signal whenever a corresponding event is detected on the notifier's file descriptor. The event is monitored until the notifier is unregistered with unregisterEventNotifier().

Registering multiple notifiers for the same file descriptor and event type is not allowed and results in undefined behaviour.

Implements libcamera::EventDispatcher.

## registerTimer()

void libcamera::EventDispatcherPoll::registerTimer | ( | Timer * | timer | ) |

virtual

Register a timer.

Parameters

  [in] | timer | The timer to register

Once the timer is registered with the dispatcher, the dispatcher will emit the timer Timer::timeout signal when the timer times out. The timer can be unregistered with unregisterTimer() before it times out, in which case the signal will not be emitted.

When the timer times out, it is automatically unregistered by the dispatcher and can be registered back as early as from the Timer::timeout signal handlers.

Registering the same timer multiple times is not allowed and results in undefined behaviour.

Implements libcamera::EventDispatcher.

## unregisterEventNotifier()

void libcamera::EventDispatcherPoll::unregisterEventNotifier | ( | EventNotifier * | notifier | ) |

virtual

Unregister an event notifier.

Parameters

  [in] | notifier | The event notifier to unregister

After this function returns the notifier is guaranteed not to emit the EventNotifier::activated signal.

If the notifier isn't registered, this function performs no operation.

Implements libcamera::EventDispatcher.

## unregisterTimer()

void libcamera::EventDispatcherPoll::unregisterTimer | ( | Timer * | timer | ) |

virtual

Unregister a timer.

Parameters

  [in] | timer | The timer to unregister

After this function returns the timer is guaranteed not to emit the Timer::timeout signal.

If the timer isn't registered, this function performs no operation.

Implements libcamera::EventDispatcher.

The documentation for this class was generated from the following files:

- include/libcamera/base/event_dispatcher_poll.h
- src/libcamera/base/event_dispatcher_poll.cpp