Changeset 3bf9d10 for tests/exceptions/cancel
- Timestamp:
- Jun 21, 2023, 9:45:08 PM (19 months ago)
- Branches:
- master
- Children:
- 6065281f
- Parents:
- 2de175ce
- Location:
- tests/exceptions/cancel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/exceptions/cancel/coroutine.cfa
r2de175ce r3bf9d10 1 1 // Try cancelling a coroutine. 2 2 3 #include <fstream.hfa> 3 4 #include <coroutine.hfa> 4 5 … … 13 14 14 15 void main(WillCancel & wc) { 15 printf("1");16 sout | '1'; 16 17 cancel_stack((internal_error){&internal_vt}); 17 printf("!");18 sout | '!'; 18 19 } 19 20 20 21 int main(int argc, char * argv[]) { 22 sout | nlOff; 21 23 WillCancel cancel; 22 24 try { 23 printf("0");25 sout | '0'; 24 26 resume(cancel); 25 printf("4");27 sout | '4'; 26 28 } catchResume (CoroutineCancelled(WillCancel) * error) { 27 printf("2");29 sout | '2'; 28 30 if ((virtual internal_error *)error->the_exception) { 29 printf("3");31 sout | '3'; 30 32 } 31 33 } 32 printf("5\n");34 sout | '5' | nl; 33 35 } -
tests/exceptions/cancel/thread.cfa
r2de175ce r3bf9d10 1 1 // Try cancelling a thread. 2 2 3 #include <fstream.hfa> 3 4 #include <thread.hfa> 4 5 … … 13 14 14 15 void main(WillCancel &) { 15 printf("1");16 sout | '1'; 16 17 cancel_stack((internal_error){&internal_vt}); 17 printf("!");18 sout | '!'; 18 19 } 19 20 20 21 void explicit() { 21 22 try { 22 printf("0");23 sout | '0'; 23 24 WillCancel cancel; 24 printf("1");25 sout | '1'; 25 26 join(cancel); 26 printf("4");27 sout | '4'; 27 28 } catchResume (ThreadCancelled(WillCancel) * error) { 28 printf("2");29 sout | '2'; 29 30 if ((virtual internal_error *)error->the_exception) { 30 printf("3");31 sout | '3'; 31 32 } 32 33 } 33 printf("5\n");34 sout | '5' | nl; 34 35 } 35 36 … … 37 38 try { 38 39 { 39 printf("0");40 sout | '0'; 40 41 WillCancel cancel; 41 printf("1");42 sout | '1'; 42 43 } 43 printf("4");44 sout | '4'; 44 45 } catchResume (ThreadCancelled(WillCancel) * error) { 45 printf("2");46 sout | '2'; 46 47 if ((virtual internal_error *)error->the_exception) { 47 printf("3");48 sout | '3'; 48 49 } 49 50 } 50 printf("5\n");51 sout | '5' | nl; 51 52 } 52 53 53 54 int main(int argc, char * argv[]) { 55 sout | nlOff; 54 56 explicit(); 55 57 implicit();
Note: See TracChangeset
for help on using the changeset viewer.