[Stackless] unexpected tasklet & channel behaviour
ardatur at mail.ru
ardatur at mail.ru
Wed Nov 1 07:54:14 CET 2006
Greetings!
The following gives the same result with 2.5 and 2.4.2; am I missing
something or is it a bug?
import stackless
def f1( n ):
print n, "a"
stackless.channel().receive()
print n, "b"
def f2( n ):
print n, "a"
c = stackless.channel()
c.receive()
print n, "b"
#### case 1: ok
t1 = stackless.tasklet( f1 )( 1 )
t1.run()
t2 = stackless.tasklet( f1 )( 2 )
t2.run()
#### case 2: ok
t1 = stackless.tasklet( f2 )( 3 )
t1.run()
t2 = stackless.tasklet( f2 )( 4 )
t2.run()
#### case 3: ???
t1 = stackless.tasklet( f1 )( 5 )
t2 = stackless.tasklet( f1 )( 6 )
t1.run()
t2.run()
#### case 4: fails at `t2.run()'
t1 = stackless.tasklet( f2 )( 7 )
t2 = stackless.tasklet( f2 )( 8 )
t1.run()
t2.run()
Output is:
1 a
2 a
3 a
4 a
5 a
6 a
6 b
7 a
8 a
Traceback (most recent call last):
File "test.py", line 30, in ?
t2.run()
RuntimeError: You cannot run a blocked tasklet
AFAICS there are 2 problems here:
1) why is `6 b' ever printed?
2) looks like `t1.run()' in the case 4 runs both t1 and t2, which
results in a `t2.run()' failure.
--
TIA,
Vladimir Pozdyayev
_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless
More information about the Stackless
mailing list