[m-users.] Calling exit(3) from a foreign predicate

Julien Fischer jfischer at opturion.com
Thu Jan 25 16:05:44 AEDT 2024


Hi,

On Wed, 24 Jan 2024, Volker Wysk wrote:

> Calling exit(3), without calling mercury_runtime_terminate() before, works.
> All thread are terminated and the program exits. It's only
> mercury_runtime_terminate() that blocks. I've read somewhere that it waits
> for all threads to terminate. Is there another function which doesn't? I'd
> like to properly shut down the Mercury runtime, if possible.

Yes, Mercury programs do not terminate until all threads created by
calls to spawn/3 terminate; mercury_runtime_terminate() will block until
this occurs. As it stands at the moment, you will need to arrange for
any remaining threads to terminate.

Julien.


More information about the users mailing list