Files
mercury/tests/hard_coded/spawn_native.exp
Peter Wang 56cebb3114 Add thread.spawn_native/4 and thread.spawn/4.
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.
2014-07-10 14:58:14 +10:00

9 lines
60 B
Plaintext

a start
b start
c start
d start
a stop
b stop
c stop
d stop