// Try cancelling a coroutine. #include #include exception internal_error {}; vtable(internal_error) internal_vt; coroutine WillCancel {}; const char * msg(CoroutineCancelled(WillCancel) * this) { return "CoroutineCancelled(WillCancel)"; } void main(WillCancel & wc) { sout | '1'; cancel_stack((internal_error){&internal_vt}); sout | '!'; } int main(int argc, char * argv[]) { sout | nlOff; WillCancel cancel; try { sout | '0'; resume(cancel); sout | '4'; } catchResume (CoroutineCancelled(WillCancel) * error) { sout | '2'; if ((virtual internal_error *)error->the_exception) { sout | '3'; } } sout | '5' | nl; }