On Mon, Oct 31, 2011 at 7:16 AM, Greg Ewing
Nick Coghlan wrote:
The fact that greenlets exists (and works) demonstrates that it is possible to correctly manage and execute multiple Python stacks within a single OS thread.
I'm not convinced that greenlets work correctly under all possible circumstances. As I understand, they work by copying pieces of C stack in and out when switching tasks. That fails if a pointer to local storage is kept anywhere that can be reached by a different task. I seem to remember there being an issue with Tk doing something like this and causing problems for Stackless.
Yeah, that sentence should have had a "mostly" inside the parentheses :) However, I think it may be more fruitful to pursue an approach that uses greenlets as the foundation, and works to close the loopholes (e.g. by figuring out a way for C code to mark itself as "coroutine safe" and assuming it is not safe by default) rather than trying to figure out how to make a "generators all the way down" approach handle invocation of arbitrary slots. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia