Subject: Re: microtime(9) slow on i386?
To: Jason R Thorpe <thorpej@wasabisystems.com>
From: Andreas Persson <pap.is@home.se>
List: tech-perform
Date: 10/24/2001 21:44:24
On Tue, Oct 23, 2001 at 01:44:55PM -0700, Jason R Thorpe <thorpej@wasabisystems.com> wrote:
>Okay, that'd be fine, but the file system code doesn't use splclock()
>mostly because it doesn't really "need"[*] to.  I don't really think you
>"need" to here, either.  But that's neither here nor there :-)
>
>[*] Yes, technically you need splclock to make access to time atomic,
>but for these applications ... maybe it doesn't matter so much.
Couldn't you decrease the chances of an inconsistent time rather cheaply
with something like:
	struct timeval tv;
	
	do {
		tv.tv_sec = time.tv_sec;
		tv.tv_usec = time.tv_usec;
	} while (tv.tv_sec != time.tv_sec || tv.tv_usec != time.tv_usec);
This should work perfectly on a single cpu system, no?

>-- 
>        -- Jason R. Thorpe <thorpej@wasabisystems.com>

-- 
Andreas Persson
pap.is@home.se