Hi, 

From: Richard Zidlicky <rz / linux-m68k.org>
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 destroy them and using explicit
> $top.withdraw sometimes causes even X server hickup.

Yes. A Tk interpreter can NOT be shared by two processes. 
So, when the child process is dead, the Tk interpreter is crashed. 
You shold call 'require "tk"' AFTER call fork. 
If you need Tk BEFORE fork, you must exec new ruby interpreter 
and run your child script on the interpreter. 
For example, 
-------------------------------------
def helper
  exec '/usr/bin/ruby', '-e', <<EofSUB
    finish=nil
    trap("SIGINT"){finish=1}
    ctr=0
    loop{
      ctr += 1
      exit  if finish and ctr>2
      sleep 20
    }
EofSUB
end
-------------------------------------
-- 
                                  Hidetoshi Nagai (nagai / ai.kyutech.ac.jp)