[m-rev.] for review: thread safe exceptions

Fergus Henderson fjh at mercury.cs.mu.oz.au
Sat Mar 1 00:03:39 AEDT 2003


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

Otherwise that looks fine.

In the long run I think it might be better to make ML_exception_handler
part of the MR_Engine() structure rather than using a new pthread_key
for this.  But this patch is certainly an improvement on the status quo.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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