From: Richard Zidlicky Date: 2003-06-14T05:11:58+09:00 Subject: Re: fork and Tk problem On Thu, Jun 12, 2003 at 04:20:35PM +0900, Hidetoshi NAGAI wrote: > Hi, > > From: Richard Zidlicky > Subject: fork and Tk problem > Date: Thu, 12 Jun 2003 00:57:58 +0900 > Message-ID: <20030611144839.GA5228@linux-m68k.org> > > I have noticed a little strangeness, a mere 'require "tkscrollbox"' > > before a fork will cause weird effects even if all Tk > > objects are created *after* the fork. Eg exiting the process > > which created the Tk objects doesn�t destroy them and using explicit > > $top.withdraw sometimes causes even X server hickup. > > Yes. A Tk interpreter can NOT be shared by two processes. this is the obvious part. > You shold call 'require "tk"' AFTER call fork. this is what got me. Although I am aware that "require" may do pretty much anything I would have thought the Tk interpreter or X connection would be created only when I explicitly create a widget, not by merely require'ing Tk. Not a problem in app, however I figure a clean way to destroy the Tk objects in a forked process would be nice in many circumstances. The same of course holds for the other GUI Toolkits. Richard