Can I raise Exception in one thread and handle it in another?
-
Hi, I am a bit curious.. Can I raise exception (with RaiseException()?) 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.. Does anybody know how it is done in Visual Studio? It's possible to freeze the debugged process anytime, when debugging.
-
Hi, I am a bit curious.. Can I raise exception (with RaiseException()?) 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.. Does anybody know how it is done in Visual Studio? It's possible to freeze the debugged process anytime, when debugging.
I do not think that the exception will cross threads. I would suggest using a Win32 Event object, because it can be seen by multiple threads, and signal it in one thread to indicate the other to stop processing. Peace!
-=- James
Please rate this message - let me know if I helped or not! * * *
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFiles -
Hi, I am a bit curious.. Can I raise exception (with RaiseException()?) 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.. Does anybody know how it is done in Visual Studio? It's possible to freeze the debugged process anytime, when debugging.
chilituna wrote:
I thought it would be nice to have one dialog where is stop button, and it stops whatever the main thread is doing..
Is the dialog modal?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
Hi, I am a bit curious.. Can I raise exception (with RaiseException()?) 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.. Does anybody know how it is done in Visual Studio? It's possible to freeze the debugged process anytime, when debugging.
chilituna wrote:
Can I raise Exception in one thread and handle it in another?
No, the handler has to be somewhere in the throwing thread's call stack.
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ");