<html><head><meta http-equiv="content-type" content="text/html; charset=us-ascii"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">What a module accessible flag for global control then I guess?<div><br></div><div style="font-size: 16px;"><font face="AgaveNFP-Regular">:- module foo.</font></div><div style="font-size: 16px;"><font face="AgaveNFP-Regular"><br></font></div><div style="font-size: 16px;"><font face="AgaveNFP-Regular">:- pred is_exit_requested.</font></div><div style="font-size: 16px;"><font face="AgaveNFP-Regular"><br></font></div><div style="font-size: 16px;"><font face="AgaveNFP-Regular">:- implementation.</font></div><div style="font-size: 16px;"><font face="AgaveNFP-Regular"><br></font></div><div style="font-size: 16px;"><font face="AgaveNFP-Regular">:- mutable (stop_flag, bool, no, ground, [...whats your app needs...]).</font></div><div style="font-size: 16px;"><font face="AgaveNFP-Regular"><br></font></div><div style="font-size: 16px;"><font face="AgaveNFP-Regular">:- pragma promise_pure(stop_threads/0). </font></div><div style="font-size: 16px;"><font face="AgaveNFP-Regular">:- pred stop_threads :-</font></div><div><font face="AgaveNFP-Regular" style="font-size: 16px;"> impure set_stop_flag(yes).<br id="lineBreakAtBeginningOfMessage"></font><div style="font-size: 16px;"><font face="AgaveNFP-Regular"><br></font></div><div style="font-size: 16px;"><font face="AgaveNFP-Regular"><br></font></div><div style="font-size: 16px;"><font face="AgaveNFP-Regular">:- pragma promise_pure(iis_exit_requested/0). </font></div><div style="font-size: 16px;"><font face="AgaveNFP-Regular">:- pred is_exit_requested is semidet.</font></div><div style="font-size: 16px;"><font face="AgaveNFP-Regular">is_exit_requested :-</font></div><div style="font-size: 16px;"><font face="AgaveNFP-Regular"> semipure get_stop_flag(yes).</font></div><div><br></div><div><br></div><div>then inside your threads you can just called foo.is_exit_requested ?</div><div>This is off the top of my head, so I have probably made a few m istakes, it's early and I've not had my porridge yet, those are my excuses!</div><div><br></div><div>That's kind of what I was hinting at nefpre; external control, but I assumed you were passing two-way control structures but if the threads have no ears then thisd might be the solution / a solution?</div><div><br></div><div>Good luck VOlker, you always figure out!</div><div><br></div><div><br><br><blockquote type="cite"><div>On 25 Jan 2024, at 05:05, Julien Fischer <jfischer@opturion.com> wrote:</div><br class="Apple-interchange-newline"><div><div><br>Hi,<br><br>On Wed, 24 Jan 2024, Volker Wysk wrote:<br><br><blockquote type="cite">Calling exit(3), without calling mercury_runtime_terminate() before, works.<br>All thread are terminated and the program exits. It's only<br>mercury_runtime_terminate() that blocks. I've read somewhere that it waits<br>for all threads to terminate. Is there another function which doesn't? I'd<br>like to properly shut down the Mercury runtime, if possible.<br></blockquote><br>Yes, Mercury programs do not terminate until all threads created by<br>calls to spawn/3 terminate; mercury_runtime_terminate() will block until<br>this occurs. As it stands at the moment, you will need to arrange for<br>any remaining threads to terminate.<br><br>Julien.<br>_______________________________________________<br>users mailing list<br>users@lists.mercurylang.org<br>https://lists.mercurylang.org/listinfo/users<br></div></div></blockquote></div><br></div></body></html>