mirror of
https://github.com/intel/llvm.git
synced 2026-01-16 05:32:28 +08:00
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
This commit is contained in:
@@ -1512,21 +1512,15 @@ Process::IsAlive ()
|
||||
// found in the global target list (we want to be completely sure that the
|
||||
// lldb_private::Process doesn't go away before we can deliver the signal.
|
||||
bool
|
||||
Process::SetProcessExitStatus (void *callback_baton,
|
||||
lldb::pid_t pid,
|
||||
bool exited,
|
||||
int signo, // Zero for no signal
|
||||
int exit_status // Exit value of process if signal is zero
|
||||
)
|
||||
Process::SetProcessExitStatus(lldb::pid_t pid, bool exited,
|
||||
int signo, // Zero for no signal
|
||||
int exit_status // Exit value of process if signal is zero
|
||||
)
|
||||
{
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_PROCESS));
|
||||
if (log)
|
||||
log->Printf ("Process::SetProcessExitStatus (baton=%p, pid=%" PRIu64 ", exited=%i, signal=%i, exit_status=%i)\n",
|
||||
callback_baton,
|
||||
pid,
|
||||
exited,
|
||||
signo,
|
||||
exit_status);
|
||||
log->Printf("Process::SetProcessExitStatus (pid=%" PRIu64 ", exited=%i, signal=%i, exit_status=%i)\n", pid,
|
||||
exited, signo, exit_status);
|
||||
|
||||
if (exited)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user