What is difference between synchronous and asynchronous exception handling? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is difference between synchronous and asynchronous exception handling?

can someone help me for understanding this fact??

27th Jun 2017, 1:43 PM
Deepak Kumar
Deepak Kumar - avatar
2 Answers
+ 1
hi Deepak, Exception handling is designed to support only synchronous exceptions, such as array range checks. The term synchronous exception means that exceptions can be originated only from throw expressions. The C++ standard supports synchronous exception handling with a termination model.  Termination means that once an exception is thrown, control never returns to the throw point. Exception handling is not designed to directly handle asynchronous exceptions such as keyboard interrupts. However, you can make exception handling work in the presence of asynchronous events if you are careful. For instance, to make exception handling work with signals, you can write a signal handler that sets a global variable, and create another routine that polls the value of that variable at regular intervals and throws an exception when the value changes. You cannot throw an exception from a signal handler.
4th Jul 2017, 1:54 PM
Nanda Balakrishnan
0
thank you
5th Jul 2017, 2:49 AM
Deepak Kumar
Deepak Kumar - avatar