From: Hidetoshi NAGAI Date: 2010-02-22T07:12:32+09:00 Subject: Re: Tk on Windows and Mac OS X 10.6 From: Michael Fellinger Subject: Re: Tk on Windows and Mac OS X 10.6 Date: Mon, 22 Feb 2010 02:50:45 +0900 Message-ID: <9c00d3e01002210950t1eab4396xd0fd977201b02d44@mail.gmail.com> > I've solved this by creating a separate thread that handles all calls > using the interp. > http://github.com/manveru/ffi-tk/blob/master/lib/ffi-tk/ffi/tcl.rb#L57 > http://github.com/manveru/ffi-tk/blob/master/lib/ffi-tk/thread_sender.rb > > By using Queue#pop, the code will simply block the Thread until it can > handle a send, > so it's very little overhead, and has zero CPU usage when idle. After calling Tk.mainloop, is the thread for Tk blocked from other thread's call? Although it is important whether threads are switched at proper timing, thread switching troubles may not occur if ffi-tk supports ruby1.9 only (I don't know about JRuby's thread switching), Maybe you should pay attention to exceptions. Does "reaper" thread down when block.call raises an exception? When ruby1->tcl-(callback)->ruby2 and ruby2 raises an exception, can ruby1 get the exception? I don't read all part of ffi-tk. I'm sorry if I misunderstand. -- Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)