//===-- MainLoopBase.h ------------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef LLDB_HOST_MAINLOOPBASE_H #define LLDB_HOST_MAINLOOPBASE_H #include "lldb/Utility/IOObject.h" #include "lldb/Utility/Status.h" #include "llvm/ADT/DenseMap.h" #include "llvm/Support/ErrorHandling.h" #include <functional> #include <mutex> 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 RegisterReadObject function return a handle, which controls the duration // of the monitoring. When this handle is destroyed, the callback is // deregistered. // // Since this class is primarily intended to be used for single-threaded // processing, it does not attempt to perform any internal synchronisation and // any concurrent accesses must be protected externally. However, it is // perfectly legitimate to have more than one instance of this class running on // separate threads, or even a single thread. class MainLoopBase { … }; } // namespace lldb_private #endif // LLDB_HOST_MAINLOOPBASE_H