fork and duplicate window manager connections
From: Ken Taylor (google_at_kjt.us)
Date: 06/28/04
- Next message: Anthony Davis: "Example pop3 server & client using the tcllib pop3"
- Previous message: Steve Bold: "Re: Tcl crashes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 28 Jun 2004 14:26:28 -0700
Running wish with expect extension, I note that when a forked client
exits, the window manager connection is destroyed. Here's a simple
test case that demonstrates the behavior:
#!/usr/local/bin/wish
package require Expect
frame .f
pack .f
text .f.main -width 80 -height 5
text .f.sub -width 80 -height 5
pack .f.main -side top -expand yes -fill x
pack .f.sub -side bottom -expand yes -fill x
wm title . "wish/fork test"
.f.main insert end "Starting Sub from [pid]...\n"
update idletasks
if {[catch exp_fork subPid]} {
error "Couldn't create subprocess - $subPid"
}
if {$subPid < 0} {
error "Couldn't create subprocess."
}
if {$subPid == 0} {
.f.sub insert end "Sub pausing 10 seconds in [pid]...\n"
update idletasks
after 10000
exit 0
}
.f.main insert end "Main giving subp time to exit.\n"
update idletasks
after 12000
.f.main insert end "Sub should have exited at this point.\n"
update idletasks
tkwait window .
####
Here's a typical error message produced by the window server
irrespective of wether the subprocess interacts with the window
manager:
/home/kjt> ./wishtest.tcl
X Error of failed request: BadDrawable (invalid Pixmap or Window
parameter)
Major opcode of failed request: 53 (X_CreatePixmap)
Resource id in failed request: 0x4c0000d
Serial number of failed request: 148
Current serial number in output stream: 123
}
A similar problem described on the perl/Tk usergroup requires the
child process
to call a Core::Exit routine. Do we get something similar available
with Wish/Expect?
http://groups.google.com/groups?q=Tk+fork+Core::Exit&hl=en&lr=&ie=UTF-8&selm=40C0A471.7000502%40gmx.net&rnum=4
- Next message: Anthony Davis: "Example pop3 server & client using the tcllib pop3"
- Previous message: Steve Bold: "Re: Tcl crashes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|