Mail Archives: cygwin-apps/2002/04/30/07:10:17
I've reviewed the use of threads, and I believe the following guidelines
will provide safe exception handling without stomping across threads.
Exception handling guidelines:
For 100% message based windows, exceptions in code will get caught by
the same thread that handles window messages - which means the
propertysheet thread. The catch routine here can only catch exceptions
within a message.
for thread based windows (i.e. site, or the current chooser, or
download), the thread reflector can catch() whatever it wants to... AS
LONG AS the window message routine does not do any exception processing
(ie , try catch or throw).
What does this mean? Well things like the nio code can throw an
authentication exception, to separate out the functional code and the
UI. This will let Pavel Tsekov's URL class get added to setup in the
near future, and will also allow some more cleanups leading up to a
command line version and or more split out support libraries.
Of course, if the gcc library (mingw or cygwin) was built with
--with-threads, this would be simpler.
Exceptions that can be thrown:
I'm going to create a base Exception class, from which all thrown
exceptions should derive. No char/string or String exceptions are
allowed. This allows a generic catch-all Exception handler, and by
subclassing, more specific handlers can sit in front of it.
Cheers,
Rob
- Raw text -