[m-rev.] for review: fix bug #357: parallel conjunction broken on OS X

Julien Fischer jfischer at opturion.com
Mon Oct 3 10:52:12 AEDT 2016


On Mon, 3 Oct 2016, Peter Wang wrote:

> 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.

Fixed.

> The rest looks fine.

Thanks,
Julien.


More information about the reviews mailing list