<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Mar 25, 2012, at 9:27 PM, Paul Reznicek wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Menlo; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="font-family: monospace; ">I have similar needs and did not found usable answers, so I wrote some<br>q&amp;d hacks for doctests and also for UI interactions, where the user should<br>be blocked until something in non-blocking deferred finish or "time-outed".<br></span></span></blockquote></div><br><div>These hacks are all pretty awful, and you generally shouldn't use them.</div><div><br></div><div>For doctests, I don't know that you can do much better (although doing what I said, and structuring your code so that the doctests can explicitly fire in-memory Deferreds or make callbacks directly instead of spinning the reactor, would be a better idea).</div><div><br></div><div>(Bottom line: don't use doctests.)</div><div><br></div><div>For user interactions, if you want to pause the ability of a user to perform certain interactions, explicitly pause or disable those interactions. &nbsp;Pretty much every GUI toolkit has a way to disable or grey out certain controls, and you should use those APIs rather than entering a broken re-entrant main loop with unsupported APIs.</div><div><br></div><div>-glyph</div><div><br></div></body></html>