Re: [gtkmm] Spawing a process and being notified of its termination
- From: Paul Davis <paul linuxaudiosystems com>
- To: Enrico Zini <zinie cs unibo it>
- Cc: gtkmm-list gnome org
- Subject: Re: [gtkmm] Spawing a process and being notified of its termination
- Date: Sun, 22 Aug 2004 10:41:32 -0400
>I know how to wait for a child process using SIGCHLD or using waitpid,
>however I'd like to run some Gtk-- code when the child exits, and
>SIGCHLD could happen when Gtk is inside some non-reentrant block.
>
>Since I presume I can't emit a signal inside the SIGCHLD handling. what
>is a Gtk friendly way of, say, popping up a MessageDialog when a child
>that was forked some time ago finally exits?
technically, there is very little you can "legally" do in a POSIX
signal handler. however, write(2) is one of them. create a FIFO, add
it to the main event loop using g_io_add() or its cousins, and then
in the SIGCHLD handled, write a byte or three to the FIFO. your main
event loop will call the io ready handler that you set up in
g_io_add(), and that handler can do whatever you want.
--p
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]