libcamera: event_dispatcher: Add interrupt() function

The new interrupt() function allows interrupting in-progress blocking
processEvents() calls. This is useful to stop running event loops.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
Laurent Pinchart
2019-01-23 10:04:23 +02:00
parent d370c1b46e
commit 4d470eb37f
4 changed files with 46 additions and 1 deletions
@@ -31,6 +31,7 @@ public:
void unregisterTimer(Timer *timer);
void processEvents();
void interrupt();
private:
struct EventNotifierSetPoll {
@@ -40,8 +41,10 @@ private:
std::map<int, EventNotifierSetPoll> notifiers_;
std::list<Timer *> timers_;
int eventfd_;
int poll(std::vector<struct pollfd> *pollfds);
void processInterrupt(const struct pollfd &pfd);
void processNotifiers(const std::vector<struct pollfd> &pollfds);
void processTimers();
};