Hi all,<br><br>Last week i've started to study (and love :P) Twisted .<br>Well, just for didactical purpose i've written a little script which download a web page (getPage) and calculate a long Fibonacci number within a deferToThread and it works perfectly.<br>
I would like to see the different threads id of the two operations (download a web page and the calculation of the number), always for didactical purposes.<br>Is there any way to do this?<br><br>Here is a piece of my script:<br>
<br>...<br> d1 = getPage('<a href="http://www.google.com/">http://www.google.com/</a>')<br> d1.addCallback(printContents)<br> <br> d = threads.deferToThread(largeFibonacciNumber)<br> d.addCallback(fibonacciCallback)<br>
<br>if __name__ == '__main__':<br> run()<br> reactor.run()<br><br>Is it possibile to print within these functions their thread id (PID is always the same :P)?<br>Something like:<br><br>...<br>Executing printContents func<br>
PID: 1234<br>Thread ID: x<br><br>...<br>Executing Fibonacci func<br>PID: 1234<br>Thread ID: y<br><br>I suppose it works in this way, isn't it?<br><br>Thanks<br>---<br>Masetto<br>