Changeset ae4af81 for tests/coroutine
- Timestamp:
- Aug 20, 2018, 7:34:27 AM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- 69efc321
- Parents:
- 5346dce
- Location:
- tests/coroutine
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/coroutine/fibonacci.c
r5346dce rae4af81 6 6 // 7 7 // fibonacci.c -- 3-state finite-state machine 8 9 8 // 10 9 // Author : Thierry Delisle 11 10 // Created On : Thu Jun 8 07:29:37 2017 12 11 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Thu Aug 16 08:18:16201814 // Update Count : 2 012 // Last Modified On : Sat Aug 18 11:21:58 2018 13 // Update Count : 24 15 14 // 16 15 … … 39 38 int main() { 40 39 Fibonacci f1, f2; 41 for ( int i = 1; i <= 10; i += 1 ) {40 for ( 10 ) { // print N Fibonacci values 42 41 sout | next( f1 ) | next( f2 ) | endl; 43 42 } // for -
tests/coroutine/pingpong.c
r5346dce rae4af81 10 10 // Created On : Wed Sep 20 11:55:23 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Sep 20 13:41:39 201713 // Update Count : 2 612 // Last Modified On : Sat Aug 18 11:31:11 2018 13 // Update Count : 28 14 14 // 15 15 … … 39 39 } 40 40 void main( PingPong & pingpong ) { // ping's starter ::main, pong's starter ping 41 for ( unsigned int i = 0; i < pingpong.N; i += 1 ) {41 for ( pingpong.N ) { // N ping-pongs 42 42 sout | pingpong.name | endl; 43 43 cycle( *pingpong.part ); -
tests/coroutine/prodcons.c
r5346dce rae4af81 10 10 // Created On : Mon Sep 18 12:23:39 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jan 2 12:17:01201813 // Update Count : 4712 // Last Modified On : Sat Aug 18 12:55:10 2018 13 // Update Count : 51 14 14 // 15 15 16 16 #include <fstream.hfa> 17 17 #include <coroutine.hfa> 18 #include <stdlib.hfa> 18 #include <stdlib.hfa> // random 19 19 #include <unistd.h> // getpid 20 20 … … 29 29 void main( Prod & prod ) with( prod ) { // starter ::main 30 30 // 1st resume starts here 31 for ( i nt i = 0; i < N; i += 1 ) {31 for ( i; N ) { // N pairs of values 32 32 int p1 = random( 100 ); 33 33 int p2 = random( 100 );
Note: See TracChangeset
for help on using the changeset viewer.