Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 May 2010 09:46:39 -0400 (EDT)
From:      Daniel Eischen <deischen@freebsd.org>
To:        Chris Vine <chris@cvine.freeserve.co.uk>
Cc:        freebsd-threads@freebsd.org
Subject:   Re: Monotonic clocks
Message-ID:  <Pine.GSO.4.64.1005240944500.5996@sea.ntplx.net>
In-Reply-To: <20100524140513.6475cb2c@boulder.homenet>
References:  <20100524140513.6475cb2c@boulder.homenet>

next in thread | previous in thread | raw e-mail | index | archive | help
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?

-- 
DE



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.64.1005240944500.5996>