Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Jun 1996 13:15:01 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        brandon@tombstone.sunrem.com (Brandon Gillespie)
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: portable microsecond sleeps
Message-ID:  <199606272015.NAA05677@phaeton.artisoft.com>
In-Reply-To: <Pine.BSF.3.91.960627120621.428A-100000@tombstone.sunrem.com> from "Brandon Gillespie" at Jun 27, 96 12:08:34 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> We have a server package that talks to a visa pos port.  We run this on a 
> unixware box and on a freebsd box.  At one point in the code we need to 
> have a microsecond sleep.  BSD has usleep(), however unixware does not 
> (unless you use /usr/ucb/cc, which is EXTREMELY broken and buggy, so its 
> not really an option :)
> 
> Instead we have tried using select to achieve a microsecond sleep, but 
> when we run this on the unixware system it munches CPU time.
> 
> Any suggestions for other ways to achieve microsecond sleeps?

UnixWare is broken.  The smalles sleep increment for select is 10uS.

UnixWare does not conform to SVID III(RT), though it claims to
implement the RT extenstions.  The difference is "system clock
frequency" vs. "system time update frequency".

This problem is inherited by the setitimer(RT)/getitimer(RT) alarm
signal generation interfaces.


The only real way to handle this on UnixWare required root provildeges.

You must use the undocumented HRT system calls ("High Resoloution Timer")
to implement small interval timings.  The interfaces are in the header
files in /usr/include/sys.

One caveat: for the timer to fire *and* be acted upon in as short a
period of time (sub quanta) as needed, you have to set the process
into a RT scheduling class.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



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