Re-Hi, On Thu, Apr 19, 2012 at 21:37, Armin Rigo <ar...@tunes.org> wrote: > You have to make sure that all tasklet.switch()es internally go back > to the main program, and not directly to another tasklet.
Ah, sorry, I confused the stackless interface. You don't switch() to tasklets, but instead call send() and receive() on channels. It's basically the same: whenever we call either send() or receive() on a channel, we internally switch back to the main program, i.e. back into the transaction's callback. This one needs to figure out, depending on the channel state and the operation we do, if the same tasklet can continue to run now or not --- which is done with transaction.add(callback-continuing-the-same-tasklet) --- and also if another blocked tasklet can now proceed --- which is done with transaction.add(callback-continuing-the-other-tasklet). So depending on the cases it will add() zero, one or two more transactions, and then finish. A bientôt, Armin. _______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev