diff options
author | Pavel Labath <labath@google.com> | 2016-05-11 16:59:04 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2016-05-11 16:59:04 +0000 |
commit | 998bdc5b7536bd2726f3017a7798f25890ee8bf7 (patch) | |
tree | 96039510ad9556fd8e02760f237f9cb2ff0bd460 /lldb/source/Host/common/MonitoringProcessLauncher.cpp | |
parent | 465a5041e938ef1d3d319847d08ab950f1684fa5 (diff) | |
download | bcm5719-llvm-998bdc5b7536bd2726f3017a7798f25890ee8bf7.tar.gz bcm5719-llvm-998bdc5b7536bd2726f3017a7798f25890ee8bf7.zip |
Generalize child process monitoring functions
Summary:
This replaces the C-style "void *" baton of the child process monitoring functions with a more
C++-like API taking a std::function. The motivation for this was that it was very difficult to
handle the ownership of the object passed into the callback function -- each caller ended up
implementing his own way of doing it, some doing it better than others. With the new API, one can
just pass a smart pointer into the callback and all of the lifetime management will be handled
automatically.
This has enabled me to simplify the rather complicated handshake in Host::RunShellCommand. I have
left handling of MonitorDebugServerProcess (my original motivation for this change) to a separate
commit to reduce the scope of this change.
Reviewers: clayborg, zturner, emaste, krytarowski
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D20106
llvm-svn: 269205
Diffstat (limited to 'lldb/source/Host/common/MonitoringProcessLauncher.cpp')
-rw-r--r-- | lldb/source/Host/common/MonitoringProcessLauncher.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/lldb/source/Host/common/MonitoringProcessLauncher.cpp b/lldb/source/Host/common/MonitoringProcessLauncher.cpp index 0fad44a9ec0..2845155987e 100644 --- a/lldb/source/Host/common/MonitoringProcessLauncher.cpp +++ b/lldb/source/Host/common/MonitoringProcessLauncher.cpp @@ -75,12 +75,10 @@ MonitoringProcessLauncher::LaunchProcess(const ProcessLaunchInfo &launch_info, E Host::MonitorChildProcessCallback callback = launch_info.GetMonitorProcessCallback(); - void *baton = nullptr; bool monitor_signals = false; if (callback) { // If the ProcessLaunchInfo specified a callback, use that. - baton = launch_info.GetMonitorProcessBaton(); monitor_signals = launch_info.GetMonitorSignals(); } else @@ -88,7 +86,7 @@ MonitoringProcessLauncher::LaunchProcess(const ProcessLaunchInfo &launch_info, E callback = Process::SetProcessExitStatus; } - process.StartMonitoring(callback, baton, monitor_signals); + process.StartMonitoring(callback, monitor_signals); if (log) log->PutCString("started monitoring child process."); } |