003 File Manager
Current Path:
/usr/src/contrib/llvm-project/lldb/include/lldb/Host
usr
/
src
/
contrib
/
llvm-project
/
lldb
/
include
/
lldb
/
Host
/
📁
..
📄
Config.h.cmake
(1.2 KB)
📄
ConnectionFileDescriptor.h
(528 B)
📄
Debug.h
(4.44 KB)
📄
Editline.h
(12.4 KB)
📄
File.h
(15.26 KB)
📄
FileAction.h
(1.35 KB)
📄
FileCache.h
(1.29 KB)
📄
FileSystem.h
(6.84 KB)
📄
Host.h
(10.04 KB)
📄
HostGetOpt.h
(699 B)
📄
HostInfo.h
(2.6 KB)
📄
HostInfoBase.h
(4.05 KB)
📄
HostNativeProcess.h
(728 B)
📄
HostNativeProcessBase.h
(1.43 KB)
📄
HostNativeThread.h
(690 B)
📄
HostNativeThreadBase.h
(1.46 KB)
📄
HostNativeThreadForward.h
(753 B)
📄
HostProcess.h
(1.7 KB)
📄
HostThread.h
(1.32 KB)
📄
LZMA.h
(883 B)
📄
LockFile.h
(704 B)
📄
LockFileBase.h
(1.52 KB)
📄
MainLoop.h
(3.83 KB)
📄
MainLoopBase.h
(2.91 KB)
📄
MonitoringProcessLauncher.h
(1.12 KB)
📄
OptionParser.h
(1.51 KB)
📄
Pipe.h
(668 B)
📄
PipeBase.h
(2.26 KB)
📄
PosixApi.h
(743 B)
📄
ProcessLaunchInfo.h
(5.36 KB)
📄
ProcessLauncher.h
(735 B)
📄
ProcessRunLock.h
(2.02 KB)
📄
PseudoTerminal.h
(8.45 KB)
📄
SafeMachO.h
(3.25 KB)
📄
Socket.h
(4.56 KB)
📄
SocketAddress.h
(5.77 KB)
📄
StringConvert.h
(1.26 KB)
📄
Terminal.h
(5.12 KB)
📄
ThreadLauncher.h
(1.39 KB)
📄
Time.h
(718 B)
📄
XML.h
(4.7 KB)
📁
common
📁
freebsd
📁
netbsd
📁
openbsd
📁
posix
Editing: MainLoop.h
//===-- MainLoop.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_MAINLOOP_H #define LLDB_HOST_MAINLOOP_H #include "lldb/Host/Config.h" #include "lldb/Host/MainLoopBase.h" #include "llvm/ADT/DenseMap.h" #include <csignal> #if !HAVE_PPOLL && !HAVE_SYS_EVENT_H && !defined(__ANDROID__) #define SIGNAL_POLLING_UNSUPPORTED 1 #endif namespace lldb_private { // Implementation of the MainLoopBase class. It can monitor file descriptors // for readability using ppoll, kqueue, poll or WSAPoll. On Windows it only // supports polling sockets, and will not work on generic file handles or // pipes. On systems without kqueue or ppoll handling singnals is not // supported. In addition to the common base, this class provides the ability // to invoke a given handler when a signal is received. // // 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 (with some limitations on signal // monitoring). // TODO: Add locking if this class is to be used in a multi-threaded context. class MainLoop : public MainLoopBase { private: class SignalHandle; public: typedef std::unique_ptr<SignalHandle> SignalHandleUP; MainLoop(); ~MainLoop() override; ReadHandleUP RegisterReadObject(const lldb::IOObjectSP &object_sp, const Callback &callback, Status &error) override; // Listening for signals from multiple MainLoop instances is perfectly safe // as long as they don't try to listen for the same signal. The callback // function is invoked when the control returns to the Run() function, not // when the hander is executed. This mean that you can treat the callback as // a normal function and perform things which would not be safe in a signal // handler. However, since the callback is not invoked synchronously, you // cannot use this mechanism to handle SIGSEGV and the like. SignalHandleUP RegisterSignal(int signo, const Callback &callback, Status &error); Status Run() override; // This should only be performed from a callback. Do not attempt to terminate // the processing from another thread. // TODO: Add synchronization if we want to be terminated from another thread. void RequestTermination() override { m_terminate_request = true; } protected: void UnregisterReadObject(IOObject::WaitableHandle handle) override; void UnregisterSignal(int signo); private: void ProcessReadObject(IOObject::WaitableHandle handle); void ProcessSignal(int signo); class SignalHandle { public: ~SignalHandle() { m_mainloop.UnregisterSignal(m_signo); } private: SignalHandle(MainLoop &mainloop, int signo) : m_mainloop(mainloop), m_signo(signo) {} MainLoop &m_mainloop; int m_signo; friend class MainLoop; SignalHandle(const SignalHandle &) = delete; const SignalHandle &operator=(const SignalHandle &) = delete; }; struct SignalInfo { Callback callback; #if HAVE_SIGACTION struct sigaction old_action; #endif bool was_blocked : 1; }; class RunImpl; llvm::DenseMap<IOObject::WaitableHandle, Callback> m_read_fds; llvm::DenseMap<int, SignalInfo> m_signals; #if HAVE_SYS_EVENT_H int m_kqueue; #endif bool m_terminate_request : 1; }; } // namespace lldb_private #endif // LLDB_HOST_MAINLOOP_H
Upload File
Create Folder