On Mon, Jun 11, 2012 at 07:21:00PM +0000, Hans Petter Selasky wrote:
> Author: hselasky
> Date: Mon Jun 11 19:20:59 2012
> New Revision: 236909
> URL: http://svn.freebsd.org/changeset/base/236909
> 
> Log:
>   Use the correct clock source when computing timeouts.

Could you please explain why? As you can see some lines above in
cv_init(), we initialize condition variable with CLOCK_MONOTONIC too:

        error = pthread_condattr_setclock(&attr, CLOCK_MONOTONIC);

>   MFC after:  1 week
> 
> Modified:
>   head/sbin/hastd/synch.h
> 
> Modified: head/sbin/hastd/synch.h
> ==============================================================================
> --- head/sbin/hastd/synch.h   Mon Jun 11 19:09:55 2012        (r236908)
> +++ head/sbin/hastd/synch.h   Mon Jun 11 19:20:59 2012        (r236909)
> @@ -168,7 +168,7 @@ cv_timedwait(pthread_cond_t *cv, pthread
>               return (false);
>       }
>  
> -        error = clock_gettime(CLOCK_MONOTONIC, &ts);
> +     error = clock_gettime(CLOCK_REALTIME, &ts);
>       PJDLOG_ASSERT(error == 0);
>       ts.tv_sec += timeout;
>       error = pthread_cond_timedwait(cv, lock, &ts);

-- 
Pawel Jakub Dawidek                       http://www.wheelsystems.com
FreeBSD committer                         http://www.FreeBSD.org
Am I Evil? Yes, I Am!                     http://tupytaj.pl

Attachment: pgpf0p5wmnsgh.pgp
Description: PGP signature

Reply via email to