From owner-svn-src-all@FreeBSD.ORG Sun Mar 18 18:51:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB77D106567A; Sun, 18 Mar 2012 18:51:51 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 883358FC1A; Sun, 18 Mar 2012 18:51:51 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id 4A12580C; Sun, 18 Mar 2012 19:51:42 +0100 (CET) Date: Sun, 18 Mar 2012 19:50:15 +0100 From: Pawel Jakub Dawidek To: David Xu Message-ID: <20120318185014.GK1340@garage.freebsd.pl> References: <201202271338.q1RDcqEQ020033@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Ms5iOKSBOB9YS8zC" Content-Disposition: inline In-Reply-To: <201202271338.q1RDcqEQ020033@svn.freebsd.org> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232209 - in head: lib/libthr/thread sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2012 18:51:52 -0000 --Ms5iOKSBOB9YS8zC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Feb 27, 2012 at 01:38:52PM +0000, David Xu wrote: > Author: davidxu > Date: Mon Feb 27 13:38:52 2012 > New Revision: 232209 > URL: http://svn.freebsd.org/changeset/base/232209 >=20 > Log: > Follow changes made in revision 232144, pass absolute timeout to kernel, > this eliminates a clock_gettime() syscall. This or some other change has broken CLOCK_MONOTONIC usage with condition variables. You should be able to reproduce this by something like this: pthread_cond_t cv; pthread_condattr_t attr; pthread_mutex_t lock; struct timespec ts; int error; (void)pthread_mutex_init(&lock, NULL); (void)pthread_condattr_init(&attr); (void)pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); (void)pthread_cond_init(&cv, &attr); (void)pthread_condattr_destroy(&attr); (void)clock_gettime(CLOCK_MONOTONIC, &ts); ts.tv_sec +=3D 10; (void)pthread_mutex_lock(&lock); (void)pthread_cond_timedwait(&cv, &lock, &ts); (void)pthread_mutex_unlock(&lock); This should timeout after 10 seconds, but pthread_cond_timedwait(3) returns immediately with ETIMEDOUT. CLOCK_REALTIME works properly. Bascially pthread_condattr_setclock(&attr, CLOCK_MONOTONIC) is no-op. If you change CLOCK_MONOTONIC to CLOCK_REALTIME in clock_gettime(2) call, it will timeout after 10 seconds. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --Ms5iOKSBOB9YS8zC Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk9mLmYACgkQForvXbEpPzS+lQCgoKdnHns+Q/E+jvCf9O9RS42y 2bQAoIAg8CMWpS3fxaqha7beqw9bG7JN =UPcG -----END PGP SIGNATURE----- --Ms5iOKSBOB9YS8zC--