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