1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-25 04:24:48 +03:00
kakoune/src/event_manager.hh

35 lines
565 B
C++
Raw Normal View History

#ifndef event_manager_hh_INCLUDED
#define event_manager_hh_INCLUDED
#include <poll.h>
#include "utils.hh"
namespace Kakoune
{
using EventHandler = std::function<void (int fd)>;
class EventManager : public Singleton<EventManager>
{
public:
EventManager();
void watch(int fd, EventHandler handler);
void unwatch(int fd);
void handle_next_events();
void force_signal(int fd);
private:
std::vector<pollfd> m_events;
std::vector<EventHandler> m_handlers;
std::vector<int> m_forced;
};
}
#endif // event_manager_hh_INCLUDED