[m-rev.] for review: don't terminate process until all threads done

Peter Wang wangp at students.csse.unimelb.edu.au
Tue May 1 11:26:23 AEST 2007


On 2007-04-30, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
> 
> On Mon, 30 Apr 2007, Peter Wang wrote:
> 
> >Branches: main
> >
> >Prevent multi-threaded programs from terminating as soon as the main thread
> >terminates, i.e. the process should not terminate until all threads 
> >started by
> >thread.spawn/3 terminate.
> 
> Is it worth having a predicate that lets the user disable it? 

Maybe, but it should be done properly, somehow.  As it is now, a Mercury
thread might still be running while the runtime is being shut down.

> I think there was a comment somewhere that indicated the reason this
> hadn't been implemented was that a good default behaviour hadn't been
> decided.  (I think this is a reasonable default behaviour.)

The comment was this, which I have deleted:

-    /*
-    ** XXX How do we ensure that the parent thread doesn't terminate until
-    ** the child thread has finished it's processing?
-    ** By the use of mutvars, or leave it up to user?
-    */

> 
> I think this is worth announcing in the NEWS file as well.

Done.

Peter
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list