mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
Most backends already mapped Mercury threads to "native" threads in spawn/3, but it was and remains an implementation detail. spawn_native provides that behaviour as a documented feature for programs which require it, including for the low-level C backend. While we are at it, add a `thread' handle type. It currently holds a thread identifier (not yet formally exported), but it may also have other uses such as a handle for a `thread.join' predicate, or a place to hold result values or uncaught exceptions. library/thread.m: Add abstract type `thread'. Add can_spawn_native. Add spawn_native/4. It can report failure to start a thread, which was missing from the spawn/3 interface. Add spawn/4 to match spawn_native/4, without the native thread requirement. Make ML_create_exclusive_thread wait for a success code from the new thread before continuing. Reduce accessibility levels in C# and Java helper classes. runtime/mercury_thread.c: Make MR_init_thread_inner and MR_setup_engine_for_threads return errors instead of aborting on failure. tests/hard_coded/Mercury.options: tests/hard_coded/Mmakefile: tests/hard_coded/spawn_native.exp2: tests/hard_coded/spawn_native.exp: tests/hard_coded/spawn_native.m: Add test case. NEWS: Announce change.
2 lines
27 B
Plaintext
2 lines
27 B
Plaintext
spawn_native not supported
|