Added watch function for child process
This commit is contained in:
parent
4aa43526ed
commit
94255ee50b
2 changed files with 13 additions and 0 deletions
|
@ -200,6 +200,7 @@ XboxdrvMain::run()
|
|||
if (!m_opts.exec.empty())
|
||||
{
|
||||
pid = spawn_exe(m_opts.exec);
|
||||
g_child_watch_add(pid, &XboxdrvMain::on_child_watch_wrap, this);
|
||||
}
|
||||
|
||||
log_debug("launching main loop");
|
||||
|
@ -213,6 +214,13 @@ XboxdrvMain::run()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
XboxdrvMain::on_child_watch(GPid pid, gint status)
|
||||
{
|
||||
log_info("child processes exited with status: " << status);
|
||||
shutdown();
|
||||
}
|
||||
|
||||
void
|
||||
XboxdrvMain::print_info(libusb_device* dev, const XPadDevice& dev_type, const Options& opts) const
|
||||
{
|
||||
|
|
|
@ -71,6 +71,11 @@ private:
|
|||
|
||||
static void on_sigint(int);
|
||||
|
||||
void on_child_watch(GPid pid, gint status);
|
||||
static void on_child_watch_wrap(GPid pid, gint status, gpointer data) {
|
||||
static_cast<XboxdrvMain*>(data)->on_child_watch(pid, status);
|
||||
}
|
||||
|
||||
private:
|
||||
XboxdrvMain(const XboxdrvMain&);
|
||||
XboxdrvMain& operator=(const XboxdrvMain&);
|
||||
|
|
Loading…
Add table
Reference in a new issue