<br><br><div><span class="gmail_quote">On 6/8/07, <b class="gmail_sendername">Ka-Hing Cheung</b> &lt;<a href="mailto:Ka-Hing.Cheung@riverbed.com">Ka-Hing.Cheung@riverbed.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Fri, 2007-06-08 at 08:09 +0800, Ludovic Coquelle wrote:<br>&gt; Thank for the reply.<br>&gt; I have no idea about the behaviour regarding the GIL.<br>&gt;<br>&gt; But I found that my problem is due to the python wrapper: this is not
<br>&gt; a bug but it cannot allow threading.<br>&gt; What happens is that the python &#39;dispatch&#39; call the underlying C<br>&gt; &#39;dispatch&#39; (of course) in one python thread. But doing that, python do<br>&gt; not control any more this thread, and thus the interpreter is blocked
<br>&gt; by this call.<br>&gt; If I add a timer event in the loop with a callback doing nothing<br>&gt; (createTimer(lambda fd,evt,obj: sleep(0)).addToLoop(timeout=0)), the C<br>&gt; code call back the python code and the other trheads can be
<br>&gt; executed ... but why use event if there is a loop on null timer doing<br>&gt; nothing!?!<br><br>It sounds like this is a bug in the wrapper. I am no python expert, but<br>I think the wrapper should give up the GIL before calling dispatch and
<br>grab it again before it calls back into python.</blockquote><div><br>Probably something like that. But it&#39;s not that easy, because it has to release the GIL before dispatch, but dispatch itself will call other python codes which should&nbsp; grab it before execution and release it before going back to dispatch ... but same for me: not a python expert!
<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">-khc<br><br></blockquote></div><br>