[m-rev.] for review: Add thread.spawn_native/4 and thread.spawn/4.

Julien Fischer jfischer at opturion.com
Fri Jun 27 11:54:00 AEST 2014


Hi Peter,

On Wed, 25 Jun 2014, Peter Wang wrote:

> -%-----------------------------------------------------------------------------%
> -
> :- implementation.
>
> +:- import_module bool.
> +:- import_module require.
> +:- import_module string.
> +
> :- pragma foreign_decl("C", "
> #ifndef MR_HIGHLEVEL_CODE
>   #if (!defined(MR_EXEC_TRACE) && !defined(MR_DEEP_PROFILING)) || !defined(MR_USE_GCC_NONLOCAL_GOTOS)
> @@ -91,32 +122,54 @@
> #endif
> ").
>
> +    % Nothing yet but it can be used to hold a thread id, joining, holding
> +    % uncaught exception values, etc.
> +:- type thread
> +    --->    thread.

Using a dummy type as the definition for thread handles means that all
thread handles will unify and compare as equal.  (Which surely shouldn't
be the case if the originate from different calls to spawn.)

Cheers,
Julien.



More information about the reviews mailing list