https://github.com/Microsoft/CNTK
Raw File
Tip revision: c7541b26a6dc44298188c3e57e9744147b1202d7 authored by Frank Seide on 15 May 2017, 06:14:44 UTC
changed m_consumers
Tip revision: c7541b2
gre.py
from greenlet import greenlet

c = 0
def f1():
  global c
  for i in range(20):
    c += 1
    print("f1", c)
    gr2.switch()

def f2():
  global c
  for i in range(20):
    c += 1
    print("f2", c)
    gr1.switch()

gr1 = greenlet(f1)
gr2 = greenlet(f2)
gr1.switch()
print("done")
back to top