| Last change
 on this file since d1566d4 was             d3cf623, checked in by Andrew Beach <ajbeach@…>, 11 months ago | 
        
          | 
Solved the requested warning with exceptions. Also went through the exceptions tests and managed to remove about 2/3rds of them from the lax list that now either didn't have any warnings or warnings because of the test itself.
 | 
        
          | 
              
Property                 mode
 set to                 100644 | 
        
          | File size:
            953 bytes | 
      
      
| Line |  | 
|---|
| 1 | // Try cancelling a thread. | 
|---|
| 2 |  | 
|---|
| 3 | #include <fstream.hfa> | 
|---|
| 4 | #include <thread.hfa> | 
|---|
| 5 |  | 
|---|
| 6 | exception internal_error {}; | 
|---|
| 7 | vtable(internal_error) internal_vt; | 
|---|
| 8 |  | 
|---|
| 9 | thread WillCancel {}; | 
|---|
| 10 |  | 
|---|
| 11 | const char * msg(ThreadCancelled(WillCancel) *) { | 
|---|
| 12 | return "ThreadCancelled(WillCancel)"; | 
|---|
| 13 | } | 
|---|
| 14 |  | 
|---|
| 15 | void main(WillCancel &) { | 
|---|
| 16 | sout | '1'; | 
|---|
| 17 | cancel_stack((internal_error){&internal_vt}); | 
|---|
| 18 | sout | '!'; | 
|---|
| 19 | } | 
|---|
| 20 |  | 
|---|
| 21 | void explicit() { | 
|---|
| 22 | try { | 
|---|
| 23 | sout | '0'; | 
|---|
| 24 | WillCancel cancel; | 
|---|
| 25 | sout | '1'; | 
|---|
| 26 | join(cancel); | 
|---|
| 27 | sout | '4'; | 
|---|
| 28 | } catchResume (ThreadCancelled(WillCancel) * error) { | 
|---|
| 29 | sout | '2'; | 
|---|
| 30 | if ((virtual internal_error *)error->the_exception) { | 
|---|
| 31 | sout | '3'; | 
|---|
| 32 | } | 
|---|
| 33 | } | 
|---|
| 34 | sout | '5' | nl; | 
|---|
| 35 | } | 
|---|
| 36 |  | 
|---|
| 37 | void implicit() { | 
|---|
| 38 | try { | 
|---|
| 39 | { | 
|---|
| 40 | sout | '0'; | 
|---|
| 41 | WillCancel cancel; | 
|---|
| 42 | sout | '1'; | 
|---|
| 43 | } | 
|---|
| 44 | sout | '4'; | 
|---|
| 45 | } catchResume (ThreadCancelled(WillCancel) * error) { | 
|---|
| 46 | sout | '2'; | 
|---|
| 47 | if ((virtual internal_error *)error->the_exception) { | 
|---|
| 48 | sout | '3'; | 
|---|
| 49 | } | 
|---|
| 50 | } | 
|---|
| 51 | sout | '5' | nl; | 
|---|
| 52 | } | 
|---|
| 53 |  | 
|---|
| 54 | int main() { | 
|---|
| 55 | sout | nlOff; | 
|---|
| 56 | explicit(); | 
|---|
| 57 | implicit(); | 
|---|
| 58 | } | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.