mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-16 09:53:36 +00:00
It is often necessary to be certain that a thread has terminated before
the rest of the program can continue. In some cases, signalling that a
thread is ABOUT to terminate (using any synchronisation device)
is insufficient: even after the last piece of Mercury code has run,
the thread still has additional cleanup code to run, which might include
arbitrary code in thread-specific data destructors, etc.
Introduce a predicate to create a joinable native thread,
and a predicate to wait for that thread to terminate (joining).
Joinable threads are only implemented for C backends for now.
library/thread.m:
Add new predicates spawn_native_joinable and join_thread.
Add a internal type thread_handle.
Rename the internal type thread_id type to thread_desc,
as thread_id is too similar to thread_handle.
tests/hard_coded/Mmakefile:
tests/hard_coded/spawn_native_joinable.exp:
tests/hard_coded/spawn_native_joinable.exp2:
tests/hard_coded/spawn_native_joinable.m:
Add test case.
NEWS.md:
Announce changes.
2 lines
36 B
Plaintext
2 lines
36 B
Plaintext
spawn_native_joinable not supported
|