2024-12-15 05:44 AEDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000336mercuryBugpublic2018-03-13 14:38
Reporterwangp 
Assigned Topbone 
PrioritylowSeverityminorReproducibilityalways
StatusacknowledgedResolutionopen 
Product Version 
Target Version15.11Fixed in Version 
Summary0000336: java programs do not wait for all threads to finish
DescriptionThe program terminates soon after the main thread exits, even if other threads are running.
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0000702

pbone (administrator)

Hi Peter,

I'm about to do some work on the Java concurrency stuff for MCit. So I'll look at this at the same time.

Thanks.

~0000705

juliensf (administrator)

The behaviour of multi-threaded programs when the main thread terminates needs to be specified
somewhere, reference manual(?) or in the comment at the head of thread.m. Furthermore the behaviour
should be consistent across backends.

~0000712

pbone (administrator)

Hi.

What should be the behavior if an error is raised. For example:
 + The exit status is set to non-zero (I think it should wait).
 + An exception is uncaught in main/2 (Should it exit immediately?)
 + Can a mercury program call abort() like one can in C?
 + An internal error (in Mercury) (it should exit immediately).

Thanks

~0000714

wangp (developer)

> What should be the behavior if an error is raised. For example:
> + The exit status is set to non-zero (I think it should wait).

Yes. It just sets a global variable.

> + An exception is uncaught in main/2 (Should it exit immediately?)

I think so.

> + Can a mercury program call abort() like one can in C?

Yes. Mercury can't prevent anyone doing so anyway.

> + An internal error (in Mercury) (it should exit immediately).

Yes. We can't continue after an internal (fatal) error.

~0000715

pbone (administrator)

> > + Can a mercury program call abort() like one can in C?
>
> Yes. Mercury can't prevent anyone doing so anyway.

What I mean is, do we provide something like abort in Mercury? (I don't remember one myself), something like:

:- pred abort(int::in, io::di, io::uo) is det.

Which doesn't return.

~0000716

juliensf (administrator)

By making the determinism of abort/3 det, you are telling the compiler that it _does_ return.
A better signature would be:

    :- pred abort(int::in, io::di) is erroneous.

In any case, I don't see the need for abort in Mercury. Every time I have needed something like it, throwing an exception back to the top-level has always sufficed.

~0000718

pbone (administrator)

Okay cool, I wasn't proposing abort/3 just asking if we already had something like this.

~0000980

pbone (administrator)

Unassigned things from me.
+Notes

-Issue History
Date Modified Username Field Change
2014-06-20 10:30 wangp New Issue
2014-06-20 11:49 pbone Assigned To => pbone
2014-06-20 11:49 pbone Status new => assigned
2014-06-20 11:49 pbone Note Added: 0000702
2014-06-24 12:37 juliensf Note Added: 0000705
2014-06-26 18:50 pbone Note Added: 0000712
2014-06-27 10:51 wangp Note Added: 0000714
2014-06-27 10:55 pbone Note Added: 0000715
2014-06-27 11:09 juliensf Note Added: 0000716
2014-06-27 11:20 pbone Note Added: 0000718
2015-11-02 11:41 pbone Target Version => 15.11
2018-03-13 14:38 pbone Status assigned => acknowledged
2018-03-13 14:38 pbone Note Added: 0000980
+Issue History