[m-rev.] for review: fix bug #357: parallel conjunction broken on OS X
Peter Wang
novalazy at gmail.com
Mon Oct 3 10:44:38 AEDT 2016
On Sun, 2 Oct 2016 00:13:54 +1000 (AEST), Julien Fischer <jfischer at opturion.com> wrote:
>
> For review by anyone.
>
> -------------------------------
>
> Fix bug #357: parallel conjunction broken on OS X.
Hi Julien,
> diff --git a/runtime/mercury_thread.h b/runtime/mercury_thread.h
> index 2dcaaa1..c518b35 100644
> --- a/runtime/mercury_thread.h
> +++ b/runtime/mercury_thread.h
> @@ -73,11 +83,21 @@
> #define MR_TIMED_WAIT(cond, mtx, abstime, from) \
> pthread_cond_timedwait((cond), (mtx), (abstime))
>
> - #define MR_SEM_WAIT(sem, from) sem_wait((sem))
> - #define MR_SEM_POST(sem, from) sem_post((sem))
> - #define MR_SEM_TIMED_WAIT(sem, abstime, from) \
> + #if defined(MR_USE_LIBDISPATCH)
> + #define MR_SEM_WAIT(sem, from) \
> + dispatch_semaphore_wait(*(sem), DISPATCH_TIME_FOREVER)
> + #define MR_SEM_POST(sem, from) dispatch_semaphore_signal(*(sem))
> + #define MR_SEM_TIMED_WAIT(sem, abstime, from) \
> + dispatch_semaphore_wait(*(sem), dispatch_walltime((abstime))
dispatch_walltime is missing the second argument.
The rest looks fine.
Peter
More information about the reviews
mailing list