从PyCharm控制台运行时,Gevent线程不会在调用start()方法时启动,只有在调用join()时才启动。 为什么?
Python 3.6.3 (default, Oct 4 2017, 06:09:38)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
import gevent
def dummy():
for _ in range(10):
print("Dummy!")
g = gevent.Greenlet(dummy)
g.start()
# Nothing happens ....
g.join()
Dummy!
Dummy!
Dummy!
Dummy!
Dummy!
Dummy!
Dummy!
Dummy!
Dummy!
Dummy!