[vlc-devel] [PATCH] Also check _POSIX_TIMERS > 0. Fix build on GNU/Hurd.

Luca Barbato lu_zero at gentoo.org
Wed Feb 19 15:05:05 CET 2014


On 19/02/14 14:42, Rafaël Carré wrote:
> Hello,
> 
> On 02/19/14 13:20, Gabriele Giacone wrote:
>> ---
>>  src/posix/thread.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/posix/thread.c b/src/posix/thread.c
>> index 07fa71e..d49e94c 100644
>> --- a/src/posix/thread.c
>> +++ b/src/posix/thread.c
>> @@ -300,7 +300,7 @@ void vlc_cond_init (vlc_cond_t *p_condvar)
>>  
>>      if (unlikely(pthread_condattr_init (&attr)))
>>          abort ();
>> -#if (_POSIX_CLOCK_SELECTION > 0)
>> +#if (_POSIX_TIMERS > 0) && (_POSIX_CLOCK_SELECTION > 0)
>>      vlc_clock_setup ();
>>      pthread_condattr_setclock (&attr, vlc_clock_id);
>>  #endif
>> @@ -874,7 +874,7 @@ mtime_t mdate (void)
>>   */
>>  void mwait (mtime_t deadline)
>>  {
>> -#if (_POSIX_CLOCK_SELECTION > 0)
>> +#if (_POSIX_TIMERS > 0) && (_POSIX_CLOCK_SELECTION > 0)
>>      vlc_clock_setup ();
>>      /* If the deadline is already elapsed, or within the clock precision,
>>       * do not even bother the system timer. */
>> @@ -901,7 +901,7 @@ void msleep (mtime_t delay)
>>  {
>>      struct timespec ts = mtime_to_ts (delay);
>>  
>> -#if (_POSIX_CLOCK_SELECTION > 0)
>> +#if (_POSIX_TIMERS > 0) && (_POSIX_CLOCK_SELECTION > 0)
>>      vlc_clock_setup ();
>>      while (clock_nanosleep (vlc_clock_id, 0, &ts, &ts) == EINTR);
>>  
>>
> 
> Looks good to me, we should use the same #ifdef in both declaration and use.

If I understood correctly ifdef would not work and, as explained, HURD
libc headers are out of specification and given the project would make
more sense fixing them than add yet-another-workaround.

lu



More information about the vlc-devel mailing list