source: doc/papers/concurrency/examples/pingpong.py @ 81a05ca

ADTarm-ehast-experimentalcleanup-dtorsenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 81a05ca was 2e041e27, checked in by Peter A. Buhr <pabuhr@…>, 6 years ago

add examples directory for testing code in the paper

  • Property mode set to 100644
File size: 359 bytes
RevLine 
[2e041e27]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.