import gevent

def foo():
    print('Running in foo')
    gevent.sleep(0)
    print 'Explicit context switch to foo again'
    
def bar():
    print 'Explicit context to bar'
    gevent.sleep(0)
    print 'Implicit context switch back to bar'
    
def foo1():
    print('Running in foo1')
    gevent.sleep(0)
    print 'Explicit context switch to foo1 again'
    
gevent.joinall([
    gevent.spawn(foo),
    gevent.spawn(bar),
    gevent.spawn(foo1),
])