from greenlet import greenlet import time def t1(): while True: print("————A————") gr2.switch() time.sleep(3) def t2(): while True: print("————B————") gr2.switch() time.sleep(2) gr1=greenlet(t1) gr2=greenlet(t2) gr1.switch()
from greenlet import greenlet import time def t1(): while True: print("————A————") gr2.switch() time.sleep(3) def t2(): while True: print("————B————") gr2.switch() time.sleep(2) gr1=greenlet(t1) gr2=greenlet(t2) gr1.switch()