source: doc/papers/concurrency/examples/pingpong.py@ 17129659

ADT arm-eh ast-experimental cleanup-dtors enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr pthread-emulation qualifiedEnum
Last change on this file since 17129659 was 2e041e27, checked in by Peter A. Buhr <pabuhr@…>, 7 years ago

add examples directory for testing code in the paper

  • Property mode set to 100644
File size: 359 bytes
Line 
1i = 0
2def pong():
3 global i
4 print( "pong" )
5 if i < 4:
6 yield from ping()
7 print( "stop pong" )
8
9def ping():
10 global i
11 print( "ping" )
12 i += 1
13 if i < 5:
14 yield from pong()
15 print( "stop ping" )
16
17p = ping()
18try:
19 next( p )
20except StopIteration:
21 print( "stop" )
22
23# Local Variables: #
24# tab-width: 4 #
25# compile-command: "python3.5 pingpong.py" #
26# End: #
Note: See TracBrowser for help on using the repository browser.