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.

35 lines
790 B

4 months ago
  1. /*
  2. * IXSelectInterrupt.h
  3. * Author: Benjamin Sergeant
  4. * Copyright (c) 2019 Machine Zone, Inc. All rights reserved.
  5. */
  6. #pragma once
  7. #include <memory>
  8. #include <stdint.h>
  9. #include <string>
  10. namespace ix
  11. {
  12. class SelectInterrupt
  13. {
  14. public:
  15. SelectInterrupt();
  16. virtual ~SelectInterrupt();
  17. virtual bool init(std::string& errorMsg);
  18. virtual bool notify(uint64_t value);
  19. virtual bool clear();
  20. virtual uint64_t read();
  21. virtual int getFd() const;
  22. virtual void* getEvent() const;
  23. // Used as special codes for pipe communication
  24. static const uint64_t kSendRequest;
  25. static const uint64_t kCloseRequest;
  26. };
  27. using SelectInterruptPtr = std::unique_ptr<SelectInterrupt>;
  28. } // namespace ix