From owner-freebsd-current@FreeBSD.ORG Mon Oct 31 10:52:44 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C6E3316A420; Mon, 31 Oct 2005 10:52:44 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 77B5343D48; Mon, 31 Oct 2005 10:52:44 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from [127.0.0.1] (davidxu@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j9VAqfIB006831; Mon, 31 Oct 2005 10:52:42 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4365F77C.4000702@freebsd.org> Date: Mon, 31 Oct 2005 18:52:44 +0800 From: David Xu User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20050928 X-Accept-Language: en-us, en MIME-Version: 1.0 To: David Xu References: <81213.1130754398@critter.freebsd.dk> <4365F687.3070105@freebsd.org> In-Reply-To: <4365F687.3070105@freebsd.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: Alexander Leidinger , Poul-Henning Kamp , freebsd-current@freebsd.org, Robert Watson Subject: Re: TSC instead of ACPI: powerd doesn't work anymore (to be expected?) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Oct 2005 10:52:44 -0000 David Xu wrote: > > In thread program, we have to use clock_gettime, for example a thread > wants to wait for condition variable for two seconds, it has to: > > struct timespec ts; > > clock_gettime(CLOCK_REALTIME, &ts); > ts.tv_sec += 2; > pthread_cond_wait(&cond, &mtx); > Should be: pthread_cond_timedwait(&cond, &mtx, &ts);