9#ifndef LLDB_HOST_MAINLOOPBASE_H
10#define LLDB_HOST_MAINLOOPBASE_H
14#include "llvm/ADT/DenseMap.h"
15#include "llvm/Support/ErrorHandling.h"
43 using TimePoint = std::chrono::time_point<std::chrono::steady_clock,
44 std::chrono::nanoseconds>;
61 AddCallback(callback, std::chrono::steady_clock::time_point());
67 AddCallback(callback, std::chrono::steady_clock::now() + delay);
75 virtual Status Run() { llvm_unreachable(
"Not implemented"); }
96 std::priority_queue<std::pair<TimePoint, Callback>,
97 std::vector<std::pair<TimePoint, Callback>>,
98 llvm::on_first<std::greater<TimePoint>>>
static llvm::raw_ostream & error(Stream &strm)
MainLoopBase & m_mainloop
IOObject::WaitableHandle m_handle
ReadHandle(const ReadHandle &)=delete
ReadHandle(MainLoopBase &mainloop, IOObject::WaitableHandle handle)
const ReadHandle & operator=(const ReadHandle &)=delete
std::unique_ptr< ReadHandle > ReadHandleUP
virtual void UnregisterReadObject(IOObject::WaitableHandle handle)=0
const MainLoopBase & operator=(const MainLoopBase &)=delete
void AddCallback(const Callback &callback, std::chrono::nanoseconds delay)
void AddPendingCallback(const Callback &callback)
std::priority_queue< std::pair< TimePoint, Callback >, std::vector< std::pair< TimePoint, Callback > >, llvm::on_first< std::greater< TimePoint > > > m_callbacks
std::optional< TimePoint > GetNextWakeupTime()
virtual ReadHandleUP RegisterReadObject(const lldb::IOObjectSP &object_sp, const Callback &callback, Status &error)=0
ReadHandleUP CreateReadHandle(const lldb::IOObjectSP &object_sp)
virtual ~MainLoopBase()=default
MainLoopBase(const MainLoopBase &)=delete
std::function< void(MainLoopBase &)> Callback
std::mutex m_callback_mutex
virtual void RequestTermination()
virtual void Interrupt()=0
std::chrono::time_point< std::chrono::steady_clock, std::chrono::nanoseconds > TimePoint
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::IOObject > IOObjectSP