Changeset d4a60ac for doc/papers
- Timestamp:
- Mar 25, 2019, 10:07:13 AM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 5b993e0
- Parents:
- 7a8f5246 (diff), e73d449 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- doc/papers/concurrency/examples
- Files:
-
- 6 added
- 4 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
doc/papers/concurrency/examples/Fib.py
r7a8f5246 rd4a60ac 1 def Fib onacci():1 def Fib(): 2 2 fn = 0; fn1 = fn; yield fn # suspend 3 3 fn = 1; fn2 = fn1; fn1 = fn; yield fn … … 7 7 8 8 9 f1 = Fib onacci()10 f2 = Fib onacci()9 f1 = Fib() 10 f2 = Fib() 11 11 for i in range( 10 ): 12 12 print( next( f1 ), next( f2 ) ) # resume -
doc/papers/concurrency/examples/FibRefactor.py
r7a8f5246 rd4a60ac 1 def Fib onacci():1 def Fib(): 2 2 def Refactor(): 3 nonlocal fn, fn1 , fn23 nonlocal fn, fn1 4 4 fn = 0; fn1 = fn 5 5 yield fn # suspend 6 6 7 def Refactor2(): 7 8 nonlocal fn, fn1, fn2 … … 14 15 fn = fn1 + fn2; fn2 = fn1; fn1 = fn; yield fn 15 16 16 f1 = Fib onacci()17 f2 = Fib onacci()17 f1 = Fib() 18 f2 = Fib() 18 19 for i in range( 10 ): 19 20 print( next( f1 ), next( f2 ) ) # resume -
doc/papers/concurrency/examples/Format.cc
r7a8f5246 rd4a60ac 31 31 // Local Variables: // 32 32 // tab-width: 4 // 33 // fill-column: 120 //34 33 // compile-command: "u++-work -O2 -nodebubg Format.cc" // 35 34 // End: // -
doc/papers/concurrency/examples/Pingpong.py
r7a8f5246 rd4a60ac 1 i = 0 1 def Scheduler 2 try: 3 yield from ping(); 4 yield from pong(); 5 except StopIteration: 6 print( "Scheduler stop" ) 7 8 2 9 def pong(): 3 global i4 10 print( "pong" ) 5 if i < 4: 11 for i in range( 10 ): 12 6 13 yield from ping() 7 14 print( "stop pong" ) -
doc/papers/concurrency/examples/ProdCons.cfa
r7a8f5246 rd4a60ac 73 73 // Local Variables: // 74 74 // tab-width: 4 // 75 // fill-column: 120 // 76 // compile-command: "cfa ProdCons.c" // 75 // compile-command: "cfa ProdCons.cfa" // 77 76 // End: //
Note: See TracChangeset
for help on using the changeset viewer.