>> the GIL is *not* supposed to lift if some threads enters native code... In such case, why background thread works at all, causing 100% CPU load? If entering native code (tcl/tk implementation in mainloop()) will not lift GIL, it will be only Tk GUI being executed. And in my example i can see opposite - Ruby code is executed and Tk GUI hangs badly. On Tue, Jan 31, 2012 at 7:44 PM, Amichai Teumim <amichai / teumim.com> wrote: > > unsubscribe; #unsubscribe; # unsubscribe > > > > On Tue, Jan 31, 2012 at 4:12 PM, Haase, Konstantin > <Konstantin.Haase / student.hpi.uni-potsdam.de> wrote: >> >> the GIL is *not* supposed to lift if some threads enters native code... >> >> On Jan 31, 2012, at 08:05 , Grigory Petrov wrote: >> >> > Hello >> > >> > Ruby 1.9 suppose to have native threads, and GIL is supposed to lift >> > if some threads enters native code (like GUI toolkit main loop or C >> > implementation of some Ruby lib). But if i start following simple code >> > sample that displays GUI in main thread and do some basic math in >> > separate thread - the GUI will hang out badly and dragging window will >> > redraw ~ every 10 seconds or so :(. I have checked with different GUI >> > toolkit, Qt (qtbindings gem) - it behaves exactly same. Tested with >> > Ruby 1.9.3-p0 on Windows 7 and OSX 10.7 >> > >> > require 'tk' >> > require 'thread' >> > require 'rexml/document' >> > Thread.new { loop { a =3D 1 } } >> > TkRoot.new.mainloop() >> > >> > Same code in Python works fine without any GUI hangs: >> > >> > from Tkinter import * >> > from threading import * >> > class WorkThread( Thread ) : >> > def run( self ) : >> > =A0 while True : >> > =A0 =A0 a =3D 1 >> > WorkThread().start() >> > Tk().mainloop() >> > >> > What i'm doing wrong? >> > >> >> >