diff options
Diffstat (limited to 'lldb/include/lldb/Host/MainLoopBase.h')
-rw-r--r-- | lldb/include/lldb/Host/MainLoopBase.h | 93 |
1 files changed, 47 insertions, 46 deletions
diff --git a/lldb/include/lldb/Host/MainLoopBase.h b/lldb/include/lldb/Host/MainLoopBase.h index da14349..cd29796 100644 --- a/lldb/include/lldb/Host/MainLoopBase.h +++ b/lldb/include/lldb/Host/MainLoopBase.h @@ -19,76 +19,77 @@ namespace lldb_private { -// The purpose of this class is to enable multiplexed processing of data from different sources -// without resorting to multi-threading. Clients can register IOObjects, which will be monitored -// for readability, and when they become ready, the specified callback will be invoked. -// Monitoring for writability is not supported, but can be easily added if needed. +// The purpose of this class is to enable multiplexed processing of data from +// different sources +// without resorting to multi-threading. Clients can register IOObjects, which +// will be monitored +// for readability, and when they become ready, the specified callback will be +// invoked. +// Monitoring for writability is not supported, but can be easily added if +// needed. // -// The RegisterReadObject function return a handle, which controls the duration of the monitoring. When +// The RegisterReadObject function return a handle, which controls the duration +// of the monitoring. When // this handle is destroyed, the callback is deregistered. // -// This class simply defines the interface common for all platforms, actual implementations are +// This class simply defines the interface common for all platforms, actual +// implementations are // platform-specific. -class MainLoopBase -{ +class MainLoopBase { private: - class ReadHandle; + class ReadHandle; public: - MainLoopBase() { } - virtual ~MainLoopBase() { } + MainLoopBase() {} + virtual ~MainLoopBase() {} - typedef std::unique_ptr<ReadHandle> ReadHandleUP; + typedef std::unique_ptr<ReadHandle> ReadHandleUP; - typedef std::function<void(MainLoopBase &)> Callback; + typedef std::function<void(MainLoopBase &)> Callback; - virtual ReadHandleUP - RegisterReadObject(const lldb::IOObjectSP &object_sp, const Callback &callback, Error &error) - { llvm_unreachable("Not implemented"); } + virtual ReadHandleUP RegisterReadObject(const lldb::IOObjectSP &object_sp, + const Callback &callback, + Error &error) { + llvm_unreachable("Not implemented"); + } - // Waits for registered events and invoke the proper callbacks. Returns when all callbacks - // deregister themselves or when someone requests termination. - virtual Error - Run() - { llvm_unreachable("Not implemented"); } + // Waits for registered events and invoke the proper callbacks. Returns when + // all callbacks + // deregister themselves or when someone requests termination. + virtual Error Run() { llvm_unreachable("Not implemented"); } - // Requests the exit of the Run() function. - virtual void - RequestTermination() - { llvm_unreachable("Not implemented"); } + // Requests the exit of the Run() function. + virtual void RequestTermination() { llvm_unreachable("Not implemented"); } protected: - ReadHandleUP - CreateReadHandle(const lldb::IOObjectSP &object_sp) - { return ReadHandleUP(new ReadHandle(*this, object_sp->GetWaitableHandle())); } + ReadHandleUP CreateReadHandle(const lldb::IOObjectSP &object_sp) { + return ReadHandleUP(new ReadHandle(*this, object_sp->GetWaitableHandle())); + } - virtual void - UnregisterReadObject(IOObject::WaitableHandle handle) - { llvm_unreachable("Not implemented"); } + virtual void UnregisterReadObject(IOObject::WaitableHandle handle) { + llvm_unreachable("Not implemented"); + } private: - class ReadHandle - { - public: - ~ReadHandle() { m_mainloop.UnregisterReadObject(m_handle); } + class ReadHandle { + public: + ~ReadHandle() { m_mainloop.UnregisterReadObject(m_handle); } - private: - ReadHandle(MainLoopBase &mainloop, IOObject::WaitableHandle handle) - : m_mainloop(mainloop), m_handle(handle) - { } + private: + ReadHandle(MainLoopBase &mainloop, IOObject::WaitableHandle handle) + : m_mainloop(mainloop), m_handle(handle) {} - MainLoopBase &m_mainloop; - IOObject::WaitableHandle m_handle; + MainLoopBase &m_mainloop; + IOObject::WaitableHandle m_handle; - friend class MainLoopBase; - DISALLOW_COPY_AND_ASSIGN(ReadHandle); - }; + friend class MainLoopBase; + DISALLOW_COPY_AND_ASSIGN(ReadHandle); + }; private: - DISALLOW_COPY_AND_ASSIGN(MainLoopBase); + DISALLOW_COPY_AND_ASSIGN(MainLoopBase); }; } // namespace lldb_private - #endif // lldb_Host_posix_MainLoopBase_h_ |