1 | //===-- MainLoopWindows.h ---------------------------------------*- C++ -*-===// |
---|---|
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #ifndef LLDB_HOST_WINDOWS_MAINLOOPWINDOWS_H |
10 | #define LLDB_HOST_WINDOWS_MAINLOOPWINDOWS_H |
11 | |
12 | #include "lldb/Host/Config.h" |
13 | #include "lldb/Host/MainLoopBase.h" |
14 | #include <csignal> |
15 | #include <list> |
16 | #include <vector> |
17 | |
18 | namespace lldb_private { |
19 | |
20 | // Windows-specific implementation of the MainLoopBase class. It can monitor |
21 | // socket descriptors for readability using WSAEventSelect. Non-socket file |
22 | // descriptors are not supported. |
23 | class MainLoopWindows : public MainLoopBase { |
24 | public: |
25 | MainLoopWindows(); |
26 | ~MainLoopWindows() override; |
27 | |
28 | ReadHandleUP RegisterReadObject(const lldb::IOObjectSP &object_sp, |
29 | const Callback &callback, |
30 | Status &error) override; |
31 | |
32 | Status Run() override; |
33 | |
34 | protected: |
35 | void UnregisterReadObject(IOObject::WaitableHandle handle) override; |
36 | |
37 | void TriggerPendingCallbacks() override; |
38 | |
39 | private: |
40 | void ProcessReadObject(IOObject::WaitableHandle handle); |
41 | llvm::Expected<size_t> Poll(); |
42 | |
43 | struct FdInfo { |
44 | void *event; |
45 | Callback callback; |
46 | }; |
47 | llvm::DenseMap<IOObject::WaitableHandle, FdInfo> m_read_fds; |
48 | void *m_trigger_event; |
49 | }; |
50 | |
51 | } // namespace lldb_private |
52 | |
53 | #endif // LLDB_HOST_WINDOWS_MAINLOOPWINDOWS_H |
54 |