Raising exception in one thread, handling in another..  
Author Message
andy237





PostPosted: Visual C++ General, Raising exception in one thread, handling in another.. Top

Hi,

I am a bit curious.. Can I raise exception (with RaiseException() )
in one thread and get it handled in another thread

This is needed for operation stop-functionality.
I thought it would be nice to have one dialog
where is stop button, and it stops whatever the
main thread is doing..

To the visual studio part of the question ;)
Does anybody know how it is done in Visual Studio
It's possible to freeze the debugged process anytime,
when debugging.

Best wishes,
Andy




Visual C++13  
 
 
valikac





PostPosted: Visual C++ General, Raising exception in one thread, handling in another.. Top

In c++ exceptions are separate for each thread. You can access existing exceptions either through your own list or one from Windows.

http://msdn2.microsoft.com/en-us/library/4t3saedz.aspx

valikac

 
 
andy237





PostPosted: Visual C++ General, Raising exception in one thread, handling in another.. Top

Ok, thanks!


 
 
einaros





PostPosted: Visual C++ General, Raising exception in one thread, handling in another.. Top

One approach to exception handling across threads is part of my cross thread call library, ThreadSynch. It can be found at http://www.codeproject.com/useritems/threadsynch.asp, should you wish to have a poke at it.