[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Portable (as possible) sub-second timers

From: Paul Eggert
Subject: Re: Portable (as possible) sub-second timers
Date: Sun, 06 Nov 2005 00:31:13 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

"Paul Smith" <address@hidden> writes:

> Should I check for usleep() if setitimer doesn't exist?  What about
> nanosleep()?  I expect many systems would need to realtime library
> (-lrt) linked to use nanosleep()?  Or not?

gnulib's nanosleep module will arrange for the -lrt and/or substitute
code if your host lacks nanosleep().  There's also the gnulib
xnanosleep module if you prefer a simpler interface.

I'm not sure why you mention setitimer as well -- what facilities do
you need other than sleeping?  But if you merely want a
high-resolution timer that is not subject to resetting or drifting,
gnulib has a gethrxtime module with support for such timers under
FreeBSD, Solaris, POSIX with CLOCK_MONOTONIC, etc.  It also knows
about -lrt.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]