You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
848 B

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