-
March 27th, 2007, 02:05 PM
#1
throw in static methods
using VC++ 2005 pro on XP 2003 server in a service program.
I have a c++ class that contains both static and non-static methods. The static methods are callback functions that I install in database server library so that the db server can call it when errors occur. When a specific error occurs I want that static method to throw an exception to be caught by one of the non-static methods -- there may be more than one instance of the non-static methods at any given time running in different threads.
Q: are exceptions thrown in a static method caught in try/catch blocks of all threads of the process or in only the thread in which it was thrown ? If there are two threads -- thread A and thread B, and thread A throws an exception will the catch block in thead B catch it? I hope not because it will make my life a lot easier
Thanks
-
March 27th, 2007, 02:59 PM
#2
Re: throw in static methods
If the static function is not called by C++ code, anything can happen to the stack, so you should not throw exceptions from it.
Get this small utility to do basic syntax highlighting in vBulletin forums (like Codeguru) easily.
Supports C++ and VB out of the box, but can be configured for other languages.
-
March 27th, 2007, 03:23 PM
#3
Re: throw in static methods
Thanks for your answer -- tis not good news and not what I wanted to hear. Guess I'll have to think of some other way to handle the problem.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|