<div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">My understanding is that because Stackless and Twisted<br>are running in the same thread, when select/poll
<br>blocks, everything will block. This is what I have<br>observed.</blockquote>
<div>&nbsp;</div>
<div>It&#39;s true, but having a scheduled task will prevent it from blocking longer than would overlap it.<br>&nbsp;</div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">&gt;If you need a tasklet to run during that time, you<br>&gt;could hook up a tasklet to run concurrently with a
<br>&gt;coiterator (twisted.internet.task.coiterate).<br>&gt;That way specific yield points could schedule the<br>&gt;reactor to select/poll for events without blocking<br>for &gt;long periods of time.<br><br>I did not see coiterate in my documentation (Twisted
<br>2.4). Looking coiterate up at<br><br><a href="http://twistedmatrix.com/documents/current/api/twisted.application.internet.CooperatorService.html">http://twistedmatrix.com/documents/current/api/twisted.application.internet.CooperatorService.html
</a><br><br>it seems to be undocumented. That said, I used<br>LoopingCall to call schedule() at regular intervals.<br>However under certain scenarios I got flaky results<br>(lost deferreds, runtime errors). It was a mess.
</blockquote>
<div>&nbsp;</div>
<div>task.LoopingCall is another method. Basically you want to do reactor.callLater(0, wakeup), so that no time is spent in select/poll other than the time to process pending events.</div>
<div>Certainly that would work, so any runtime issues you had with it should be solvable.</div>
<div>&nbsp;</div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">When I have time, I will look at coiterate. I am<br>always on the lookout for a better way of doing<br>things. So far it seems to me that running Stackless
<br>and Twisted in their own threads seems straightforward<br>and safe.</blockquote>
<div>&nbsp;</div>
<div>The problem with two threads in my opinion is the multitude of race conditions and such that arise. If you have a good separation between the tasklets task and the network tasks, this could be ok. But, if you had a tasklet for every connection it could get quite difficult to coordinate.
</div>
<div>&nbsp;</div>
<div>-Greg</div><br>&nbsp;</div>