[vlc-devel] [PATCH] clock_nanosleep() is optional

Rémi Denis-Courmont remi at remlab.net
Wed Aug 31 08:11:07 CEST 2011


On Wed, 31 Aug 2011 01:15:50 -0400, Rafaël Carré <rafael.carre at gmail.com>
wrote:
> Its presence depends on _POSIX_CLOCK_SELECTION
> 
> Note: "If the symbolic constant _POSIX_CLOCK_SELECTION is defined, then
> the symbolic constant _POSIX_TIMERS shall also be defined by the
> implementation to have the value 200112L."
> So perhaps we could change the check to _POSIX_TIMERS to
> _POSIX_CLOCK_SELECTION
> ---
>  src/posix/thread.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/src/posix/thread.c b/src/posix/thread.c
> index 9064563..4d356be 100644
> --- a/src/posix/thread.c
> +++ b/src/posix/thread.c
> @@ -80,7 +80,7 @@
>  # define _POSIX_MONOTONIC_CLOCK (-1)
>  #endif
>  
> -#if (_POSIX_TIMERS > 0)
> +#if (_POSIX_TIMERS > 0) && (_POSIX_CLOCK_SELECTION > 0)
>  static unsigned vlc_clock_prec;

I don't see any need for this.

> @@ -942,7 +942,7 @@ void vlc_control_cancel (int cmd, ...)
>   */
>  mtime_t mdate (void)
>  {
> -#if (_POSIX_TIMERS > 0)
> +#if (_POSIX_TIMERS > 0) && (_POSIX_CLOCK_SELECTION > 0)
>      struct timespec ts;

I also don't see any need for that.

>      vlc_clock_setup ();
> @@ -968,7 +968,7 @@ mtime_t mdate (void)
>   */
>  void mwait (mtime_t deadline)
>  {
> -#if (_POSIX_TIMERS > 0)
> +#if (_POSIX_TIMERS > 0) && (_POSIX_CLOCK_SELECTION > 0)

The first predicate is redundant.

>      vlc_clock_setup ();
>      /* If the deadline is already elapsed, or within the clock
precision,
>       * do not even bother the system timer. */
> @@ -996,7 +996,7 @@ void msleep (mtime_t delay)
>      struct timespec ts = mtime_to_ts (delay);
>  
>      vlc_clock_setup ();
> -#if (_POSIX_TIMERS > 0)
> +#if (_POSIX_TIMERS > 0) && (_POSIX_CLOCK_SELECTION > 0)

Same here.

>      while (clock_nanosleep (vlc_clock_id, 0, &ts, &ts) == EINTR);
>  
>  #else


-- 
Rémi Denis-Courmont
http://www.remlab.net/



More information about the vlc-devel mailing list