1/*
2 * IXSelectInterruptEvent.h
3 */
4
5#pragma once
6
7#include "IXSelectInterrupt.h"
8#include <mutex>
9#include <stdint.h>
10#include <string>
11#include <deque>
12#ifdef _WIN32
13#include <windows.h>
14#endif
15
16namespace ix
17{
18 class SelectInterruptEvent final : public SelectInterrupt
19 {
20 public:
21 SelectInterruptEvent();
22 virtual ~SelectInterruptEvent();
23
24 bool init(std::string& /*errorMsg*/) final;
25
26 bool notify(uint64_t value) final;
27 bool clear() final;
28 uint64_t read() final;
29 void* getEvent() const final;
30 private:
31 // contains every value only once, new values are inserted at the begin, nu
32 std::deque<uint64_t> _values;
33 std::mutex _valuesMutex;
34#ifdef _WIN32
35 // Windows Event to wake up the socket poll
36 HANDLE _event;
37#endif
38 };
39} // namespace ix
40