stackless通道的receive函数没有被阻塞

问题提出

文档上说stackless通道的receive函数,在这个通道send之前,会被阻塞。但是经测试,未被阻塞。

问题描述


  1 import stackless
  2 
  3 ping_channel = stackless.channel()
  4 
  5 def ping():
  6     while True:
  7         print ping_channel.receive()
  8 
  9 stackless.tasklet(ping)()
 10 stackless.tasklet(ping_channel.send)('I will block ping')
 11 stackless.run()

终端上只打印了
I will block ping
然后程序就退出了

~$ python test.py 
I will block ping
~$

如果注释掉第10行,则程序直接退出

http://zhidao.baidu.com/link?url=ONDjddtHiMiWS9J6Y69g6R1xn-1tUkrLxMAh3Fo0Y-vLGQAtaWF6DMZ-GLtzTWzD8mMk2U2jUfBbQ92THrnea_