Changeset 9129a84 for src/examples
- Timestamp:
- Nov 28, 2016, 4:02:45 PM (8 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, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 1f44196
- Parents:
- f773f67
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/examples/coroutine.c ¶
rf773f67 r9129a84 12 12 13 13 coroutine* this_coroutine(Fibonacci* this) { 14 14 return &this->c; 15 15 } 16 16 … … 19 19 this->fn = 0; 20 20 fn1 = this->fn; 21 suspend( this); // return to last resume21 suspend(); // return to last resume 22 22 23 23 this->fn = 1; 24 24 fn2 = fn1; 25 25 fn1 = this->fn; 26 suspend( this); // return to last resume26 suspend(); // return to last resume 27 27 28 28 for ( ;; ) { … … 30 30 fn2 = fn1; 31 31 fn1 = this->fn; 32 suspend( this); // return to last resume32 suspend(); // return to last resume 33 33 } 34 34 } … … 39 39 } 40 40 41 voidmain() {41 int main() { 42 42 Fibonacci f1, f2; 43 43 for ( int i = 1; i <= 10; i += 1 ) { 44 44 sout | next(&f1) | ' ' | next(&f2) | endl; 45 45 } 46 47 return 0; 46 48 }
Note: See TracChangeset
for help on using the changeset viewer.