Files
external_libcamera/include/libcamera/base/event_dispatcher_poll.h
Kieran Bingham e228c290c9 libcamera/base: Validate internal headers as private
Headers which must not be exposed as part of the public libcamera API
should include base/private.h.

Any interface which includes the private.h header will only be able to
build if the libcamera_private dependency is used (or the
libcamera_base_private dependency directly).

Build targets which are intended to use the private API's will use the
libcamera_private to handle the automatic definition of the inclusion
guard.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25 16:11:11 +01:00

61 lines
1.3 KiB
C++

/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* event_dispatcher_poll.h - Poll-based event dispatcher
*/
#ifndef __LIBCAMERA_BASE_EVENT_DISPATCHER_POLL_H__
#define __LIBCAMERA_BASE_EVENT_DISPATCHER_POLL_H__
#include <list>
#include <map>
#include <vector>
#include <libcamera/base/private.h>
#include <libcamera/base/event_dispatcher.h>
struct pollfd;
namespace libcamera {
class EventNotifier;
class Timer;
class EventDispatcherPoll final : public EventDispatcher
{
public:
EventDispatcherPoll();
~EventDispatcherPoll();
void registerEventNotifier(EventNotifier *notifier);
void unregisterEventNotifier(EventNotifier *notifier);
void registerTimer(Timer *timer);
void unregisterTimer(Timer *timer);
void processEvents();
void interrupt();
private:
struct EventNotifierSetPoll {
short events() const;
EventNotifier *notifiers[3];
};
int poll(std::vector<struct pollfd> *pollfds);
void processInterrupt(const struct pollfd &pfd);
void processNotifiers(const std::vector<struct pollfd> &pollfds);
void processTimers();
std::map<int, EventNotifierSetPoll> notifiers_;
std::list<Timer *> timers_;
int eventfd_;
bool processingEvents_;
};
} /* namespace libcamera */
#endif /* __LIBCAMERA_BASE_EVENT_DISPATCHER_POLL_H__ */