[m-rev.] for review: thread safe exceptions
Peter Ross
pro at missioncriticalit.com
Tue Mar 4 01:03:24 AEDT 2003
On Sat, Mar 01, 2003 at 12:03:39AM +1100, Fergus Henderson wrote:
> On 28-Feb-2003, Peter Ross <pro at missioncriticalit.com> wrote:
> > Get exception handling working in the parallel grades.
> ...
> > Index: library/exception.m
> ...
> > -/*
> > -** XXX This is currently not thread-safe!
> > -** The ML_exception_handler variable should be thread-local.
> > -*/
> > -ML_ExceptionHandler *ML_exception_handler;
> > +#ifndef MR_THREAD_SAFE
> > + ML_ExceptionHandler *ML_exception_handler;
> > +#endif
> > +
> > +#ifdef MR_THREAD_SAFE
> > + #define ML_GET_EXCEPTION_HANDLER MR_GETSPECIFIC(MR_exception_handler_key)
>
> I suggest making that a function-like macro, i.e.
> s/ML_GET_EXCEPTION_HANDLER/ML_GET_EXCEPTION_HANDLER()/g
>
Done.
diff -u library/exception.m library/exception.m
--- library/exception.m 28 Feb 2003 09:39:34 -0000
+++ library/exception.m 2 Mar 2003 11:09:50 -0000
@@ -782,18 +782,18 @@
#endif
#ifdef MR_THREAD_SAFE
- #define ML_GET_EXCEPTION_HANDLER MR_GETSPECIFIC(MR_exception_handler_key)
+ #define ML_GET_EXCEPTION_HANDLER() MR_GETSPECIFIC(MR_exception_handler_key)
#define ML_SET_EXCEPTION_HANDLER(val) \
pthread_setspecific(MR_exception_handler_key, (val))
#else /* !MR_THREAD_SAFE */
- #define ML_GET_EXCEPTION_HANDLER ML_exception_handler
+ #define ML_GET_EXCEPTION_HANDLER() ML_exception_handler
#define ML_SET_EXCEPTION_HANDLER(val) ML_exception_handler = (val)
#endif /* !MR_THREAD_SAFE */
void MR_CALL
mercury__exception__builtin_throw_1_p_0(MR_Univ exception)
{
- ML_ExceptionHandler *exception_handler = ML_GET_EXCEPTION_HANDLER;
+ ML_ExceptionHandler *exception_handler = ML_GET_EXCEPTION_HANDLER();
if (exception_handler == NULL) {
ML_report_uncaught_exception((MR_Word) exception);
@@ -889,7 +889,7 @@
ML_ExceptionHandler this_handler;
ML_DECLARE_AGC_HANDLER
- this_handler.prev = ML_GET_EXCEPTION_HANDLER;
+ this_handler.prev = ML_GET_EXCEPTION_HANDLER();
ML_SET_EXCEPTION_HANDLER(&this_handler);
ML_INSTALL_AGC_HANDLER(type_info, handler_pred);
@@ -923,7 +923,7 @@
ML_ExceptionHandler this_handler;
ML_DECLARE_AGC_HANDLER
- this_handler.prev = ML_GET_EXCEPTION_HANDLER;
+ this_handler.prev = ML_GET_EXCEPTION_HANDLER();
ML_SET_EXCEPTION_HANDLER(&this_handler);
ML_INSTALL_AGC_HANDLER(type_info, handler_pred);
@@ -983,7 +983,7 @@
ML_SET_EXCEPTION_HANDLER(&this_handler);
}
- this_handler.prev = ML_GET_EXCEPTION_HANDLER;
+ this_handler.prev = ML_GET_EXCEPTION_HANDLER();
ML_SET_EXCEPTION_HANDLER(&this_handler);
ML_INSTALL_AGC_HANDLER(type_info, handler_pred);
@@ -1052,7 +1052,7 @@
locals.cont = cont;
locals.cont_env = cont_env;
- locals.this_handler.prev = ML_GET_EXCEPTION_HANDLER;
+ locals.this_handler.prev = ML_GET_EXCEPTION_HANDLER();
ML_SET_EXCEPTION_HANDLER(&locals.this_handler);
ML_INSTALL_AGC_HANDLER(type_info, handler_pred);
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list