--90e6ba6e8ef85e1adf04b7d4d738
Content-Type: text/plain; charset=ISO-8859-1

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   } }
> > 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 ) :
> >   while True :
> >     a  
> > WorkThread().start()
> > Tk().mainloop()
> >
> > What i'm doing wrong?
> >
>
>
>

--90e6ba6e8ef85e1adf04b7d4d738
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir="ltr"><br clear="all"><div dir="ltr">







<p>unsubscribe; #unsubscribe; # unsubscribe</p></div>
<br><br><div class="gmail_quote">On Tue, Jan 31, 2012 at 4:12 PM, Haase, Konstantin <span dir="ltr">&lt;Konstantin.Haase / student.hpi.uni-potsdam.de&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">the GIL is *not* supposed to lift if some threads enters native code...<br>
<br>
On Jan 31, 2012, at 08:05 , Grigory Petrov wrote:<br>
<br>
&gt; Hello<br>
&gt;<br>
&gt; Ruby 1.9 suppose to have native threads, and GIL is supposed to lift<br>
&gt; if some threads enters native code (like GUI toolkit main loop or C<br>
&gt; implementation of some Ruby lib). But if i start following simple code<br>
&gt; sample that displays GUI in main thread and do some basic math in<br>
&gt; separate thread - the GUI will hang out badly and dragging window will<br>
&gt; redraw ~ every 10 seconds or so :(. I have checked with different GUI<br>
&gt; toolkit, Qt (qtbindings gem) - it behaves exactly same. Tested with<br>
&gt; Ruby 1.9.3-p0 on Windows 7 and OSX 10.7<br>
&gt;<br>
&gt; require &#39;tk&#39;<br>
&gt; require &#39;thread&#39;<br>
&gt; require &#39;rexml/document&#39;<br>
&gt; Thread.new { loop { a = 1 } }<br>
&gt; TkRoot.new.mainloop()<br>
&gt;<br>
&gt; Same code in Python works fine without any GUI hangs:<br>
&gt;<br>
&gt; from Tkinter import *<br>
&gt; from threading import *<br>
&gt; class WorkThread( Thread ) :<br>
&gt; def run( self ) :<br>
&gt; while True :<br>
&gt; a = 1<br>
&gt; WorkThread().start()<br>
&gt; Tk().mainloop()<br>
&gt;<br>
&gt; What i&#39;m doing wrong?<br>
&gt;<br>
<br>
<br>
</blockquote></div><br></div>

--90e6ba6e8ef85e1adf04b7d4d738--