<div class="gmail_quote">On Thu, Sep 29, 2011 at 10:37 AM, Victor Hooi <span dir="ltr">&lt;<a href="mailto:victorhooi@yahoo.com">victorhooi@yahoo.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div>However, what did you mean by it may be &quot;nontrivial to use twisted with non-twisted friendly libraries&quot;? What would make a library non-Twisted friendly?</div></blockquote><div><br></div><div>Most important, I think, is for non-reactor code to not block.  E.g. if you&#39;re using a library to read from a database, the database library code should release control between the time you make a request and the time the library delivers the results of that request.  For example, a &quot;nice&quot; request call might have a callback argument and return immediately, triggering the callback when results are ready.</div>

<div><br></div><div>Note that if you *must* use a library which is blocking, a possible solution is to execute the blocking code in a thread.  But, this isn&#39;t easy to get right and the python GIL can cause problems if you need a lot of threads.</div>

<div><br></div><div>Jason</div><div><br></div></div>