From owner-freebsd-threads@FreeBSD.ORG Mon May 24 14:14:28 2010 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ABEAE106566C for ; Mon, 24 May 2010 14:14:28 +0000 (UTC) (envelope-from chris@cvine.freeserve.co.uk) Received: from smtp6.freeserve.com (smtp5.freeserve.com [193.252.22.151]) by mx1.freebsd.org (Postfix) with ESMTP id 463FC8FC13 for ; Mon, 24 May 2010 14:14:27 +0000 (UTC) Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf3521.me.freeserve.com (SMTP Server) with ESMTP id ADDFF1C0075D; Mon, 24 May 2010 16:14:26 +0200 (CEST) Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf3521.me.freeserve.com (SMTP Server) with ESMTP id A080B1C007A1; Mon, 24 May 2010 16:14:26 +0200 (CEST) Received: from boulder.homenet (unknown [91.106.62.39]) by mwinf3521.me.freeserve.com (SMTP Server) with ESMTP id 6A01F1C0075D; Mon, 24 May 2010 16:14:26 +0200 (CEST) X-ME-UUID: 20100524141426434.6A01F1C0075D@mwinf3521.me.freeserve.com Received: from boulder.homenet (IDENT:1000@localhost [127.0.0.1]) by boulder.homenet (8.14.3/8.14.3) with ESMTP id o4OEEQNd031878; Mon, 24 May 2010 15:14:27 +0100 Date: Mon, 24 May 2010 15:14:26 +0100 From: Chris Vine To: Daniel Eischen Message-ID: <20100524151426.7ec75b1a@boulder.homenet> In-Reply-To: References: <20100524140513.6475cb2c@boulder.homenet> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-threads@freebsd.org Subject: Re: Monotonic clocks X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 May 2010 14:14:28 -0000 On Mon, 24 May 2010 09:46:39 -0400 (EDT) Daniel Eischen wrote: > On Mon, 24 May 2010, Chris Vine wrote: > > > Hi, > > > > I am the upstream maintainer of efax-gtk and I am told recent > > versions of the program will not compile on the FreeBSD port of > > debian, because FreeBSD does not appear to provide > > pthread_condattr_setclock() to set a monotonic clock on condition > > variables. > > > > The program configuration script calls up sysconf() to determine > > whether the POSIX advanced realtime option (_SC_MONOTONIC_CLOCK) is > > provided, and FreeBSD's sysconf() indicates that it is. Is anything > > else needed to enable monotonic clocks on BSD, or is sysconf() > > incorrectly advertising the implementation of monotonic clocks in > > BSD's libc? > > What version of FreeBSD are you using? The code looks like it > tries to use CLOCK_MONOTONIC if specified. From > src/lib/libthr/thread/thr_init.c: > > int > _pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t > clock_id) { > if (attr == NULL || *attr == NULL) > return (EINVAL); > if (clock_id != CLOCK_REALTIME && > clock_id != CLOCK_VIRTUAL && > clock_id != CLOCK_PROF && > clock_id != CLOCK_MONOTONIC) { > return (EINVAL); > } > (*attr)->c_clockid = clock_id; > return (0); > } > > Are you getting an error from pthread_condattr_setclock() or is > it just not functioning correctly? The function is entirely missing from the pthread.h header. I don't use FreeBSD but the problem arises on the version of FreeBSD used by debian. I don't know what that is, I am afraid. I am hopeful that checking for_POSIX_CLOCK_SELECTION and _SC_CLOCK_SELECTION, as well as _POSIX_MONOTONIC_CLOCK and _SC_MONOTONIC_CLOCK will address the problem. (This means that the system clock will be used instead.) Chris