<div class="gmail_quote">On Thu, Sep 29, 2011 at 10:37 AM, Victor Hooi <span dir="ltr"><<a href="mailto:victorhooi@yahoo.com">victorhooi@yahoo.com</a>></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 "nontrivial to use twisted with non-twisted friendly libraries"? 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'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 "nice" 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'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>