9#ifndef LLDB_HOST_ALARM_H
10#define LLDB_HOST_ALARM_H
14#include "llvm/Support/Chrono.h"
16#include <condition_variable>
enables scheduling a callback function after a specified timeout.
bool m_exit
Flag to signal the alarm thread to exit.
std::function< void()> Callback
llvm::sys::TimePoint<> TimePoint
TimePoint GetNextExpiration() const
Helper to compute the next time the alarm thread needs to wake up.
lldb::thread_result_t AlarmThread()
bool AlarmThreadRunning()
static constexpr Handle INVALID_HANDLE
Duration m_timeout
Timeout between when an alarm is created and when it fires.
void StartAlarmThread()
Helper functions to start, stop and check the status of the alarm thread.
std::vector< Entry > m_entries
List of alarm entries.
bool m_run_callbacks_on_exit
Flag to signal we should run all callbacks on exit.
std::condition_variable m_alarm_cv
Condition variable used to wake up the alarm thread.
static Handle GetNextUniqueHandle()
Return an unique, monotonically increasing handle.
bool Cancel(Handle handle)
Cancel the alarm for the given Handle.
bool Restart(Handle handle)
Restart the alarm for the given Handle.
bool m_recompute_next_alarm
Flag to signal the alarm thread that something changed and we need to recompute the next alarm.
std::mutex m_alarm_mutex
Synchronize access between the alarm thread and the main thread.
Handle Create(Callback callback)
Create an alarm for the given callback.
std::chrono::milliseconds Duration
HostThread m_alarm_thread
The alarm thread.
A class that represents a running process on the host machine.
bool operator==(const Entry &rhs)