Commit b7e32d1d authored by Nalin Dahyabhai's avatar Nalin Dahyabhai

pass the global reaper in as data when adding the child source, not the

* src/reaper.c(vte_reaper_add_child): pass the global reaper in as data when
	adding the child source, not the terminal which called us.  Stop
	accepting a data argument, because we'd discard it anyway.  Return the
	ID of the source which is added, if that happens.
* configure.in: define VTE_INVALID_SOURCE for internal use.
parent 8a96cb75
2004-05-02 nalin
* src/reaper.c(vte_reaper_add_child): pass the global reaper in as
data when adding the child source, not the terminal which called us.
Stop accepting a data argument, because we'd discard it anyway. Return
the ID of the source which is added, if that happens.
* configure.in: define VTE_INVALID_SOURCE for internal use.
2004-05-01 nalin
* README: add pointers to info on bidirectional text and shaping.
......
......@@ -231,6 +231,7 @@ fi
# Miscellaneous definitions.
AC_DEFINE(VTE_UTF8_BPC,6,[Maximum number of bytes used per UTF-8 character.])
AC_DEFINE(VTE_INVALID_SOURCE,-1,[A number which can never be a valid source ID.])
AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE",[Package name.])
# Check for headers.
......
......@@ -87,6 +87,10 @@ vte_reaper_emit_signal(GIOChannel *channel, GIOCondition condition,
g_assert(data == singleton_reaper);
read(singleton_reaper->iopipe[0], &info, sizeof(info));
if (info.signum == SIGCHLD) {
if (_vte_debug_on(VTE_DEBUG_SIGNALS)) {
fprintf(stderr, "Reaper emitting child-exited "
"signal.\n");
}
g_signal_emit_by_name(data, "child-exited",
info.pid, info.status);
}
......@@ -97,26 +101,41 @@ vte_reaper_emit_signal(GIOChannel *channel, GIOCondition condition,
static void
vte_reaper_child_watch_cb(GPid pid, gint status, gpointer data)
{
if (_vte_debug_on(VTE_DEBUG_SIGNALS)) {
fprintf(stderr, "Reaper emitting child-exited signal.\n");
}
g_signal_emit_by_name(data, "child-exited", pid, status);
}
#endif
static void
vte_reaper_child_watch_destroyed(gpointer data)
{
/* no-op */
}
/**
* vte_reaper_add_child:
* @pid: the ID of a child process which will be monitored
* @data: callback data
*
* Ensures that child-exited signals will be emitted when @pid exits. This is
* necessary for correct operation when running with glib versions >= 2.4.
*
* Returns: the new source ID
*
* Since 0.11.11
*/
void
vte_reaper_add_child(GPid pid, gpointer data)
int
vte_reaper_add_child(GPid pid)
{
#if GLIB_CHECK_VERSION(2,4,0)
g_child_watch_add(pid, vte_reaper_child_watch_cb, data);
return g_child_watch_add_full(G_PRIORITY_HIGH,
pid,
vte_reaper_child_watch_cb,
vte_reaper_get(),
vte_reaper_child_watch_destroyed);
#endif
return VTE_INVALID_SOURCE;
}
static void
......
......@@ -58,7 +58,7 @@ GType vte_reaper_get_type(void);
VteReaperClass))
VteReaper *vte_reaper_get(void);
void vte_reaper_add_child(GPid pid, gpointer data);
int vte_reaper_add_child(GPid pid);
G_END_DECLS
......
......@@ -111,7 +111,6 @@ typedef gunichar wint_t;
#define VTE_REGCOMP_FLAGS REG_EXTENDED
#define VTE_REGEXEC_FLAGS 0
#define VTE_INPUT_CHUNK_SIZE 0x1000
#define VTE_INVALID_SOURCE -1
#define VTE_INVALID_BYTE '?'
#define VTE_COALESCE_TIMEOUT 2
......@@ -7138,7 +7137,7 @@ _vte_terminal_fork_basic(VteTerminal *terminal, const char *command,
/* Catch a child-exited signal from the child pid. */
reaper = vte_reaper_get();
vte_reaper_add_child((GPid) pid, terminal);
vte_reaper_add_child((GPid) pid);
g_object_ref(G_OBJECT(reaper));
if (VTE_IS_REAPER(terminal->pvt->pty_reaper)) {
g_signal_handlers_disconnect_by_func(terminal->pvt->pty_reaper,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment