How to to kill a c program at the exit of my gui?
From: Hao Xu (hxu_at_mail.linx-info.com)
Date: 05/13/04
- Next message: Akhilesh Dwivedi: "Tix support for TCL 8.4.6"
- Previous message: Donald Arseneau: "Re: TIP #185: Null Handling"
- Next in thread: Cameron Laird: "Re: How to to kill a c program at the exit of my gui?"
- Reply: Cameron Laird: "Re: How to to kill a c program at the exit of my gui?"
- Reply:(deleted message) Melissa Schrumpf: "Re: How to to kill a c program at the exit of my gui?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 13 May 2004 15:07:27 +0800
Hi averyone!
I wrote a C program to receive interesting things from gateway. It's
name is recv. I also wrote a TclTk gui to control this prog.
set fd [open "|/usr/local/bin/recv" r+]
When start up, this program reads username and password from stdin(now
redirected to $fd) for authentication, and after authentication, the
program does not need to read anything more from $fd, it enters an
while(1) loop to read the socket.
Now I found that after the exit of the TclTk gui, the recv program is
still running, which is not what I want.
I know that I can kill the recv program by "exec kill [pid $fd]", but
I don't want to terminate the program this way.
I think that at the exit of the TclTk gui, the $fd breaks, and there
is EOF of stdin, isn't it? So I want the recv program to know this
signal, and use the corresponding signal handler to kill itself.
My question is:
Is this feasible? If the answer is yes, then how to do this?
Thank you!
X.H.
- Next message: Akhilesh Dwivedi: "Tix support for TCL 8.4.6"
- Previous message: Donald Arseneau: "Re: TIP #185: Null Handling"
- Next in thread: Cameron Laird: "Re: How to to kill a c program at the exit of my gui?"
- Reply: Cameron Laird: "Re: How to to kill a c program at the exit of my gui?"
- Reply:(deleted message) Melissa Schrumpf: "Re: How to to kill a c program at the exit of my gui?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|