svn commit: r236909 - head/sbin/hastd

Pawel Jakub Dawidek pjd at FreeBSD.org
Mon Jun 11 20:07:03 UTC 2012


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20120611/7bcad779/attachment.pgp


More information about the svn-src-all mailing list