Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Feb 2008 05:08:14 +1100
From:      Peter Jeremy <peterjeremy@optushome.com.au>
To:        Andrew Pogrebennyk <marduk@portaone.com>
Cc:        freebsd-hackers@freebsd.org, Sharad Chandra <sharadc@in.niksun.com>
Subject:   Re: usleep
Message-ID:  <20080222180813.GD51095@server.vk2pj.dyndns.org>
In-Reply-To: <47BEE6E7.9030804@portaone.com>
References:  <200802221558.42443.sharadc@in.niksun.com> <47BEE6E7.9030804@portaone.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--/ZYM6PqDyfNytx60
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Feb 22, 2008 at 05:14:47PM +0200, Andrew Pogrebennyk wrote:
>Additionally, this C routine is considered obsolete

Can you provide a reference for this please.

> (unlike shell command by the same name).

I've never seen a shell function called usleep.  Which shell are you using?

> The interaction of this function with SIGALRM
>and other timer functions such as sleep(), alarm(), setitimer(), and
>nanosleep() is unspecified.

Possibly on some OSs but not on FreeBSD.

> Additionally, its use in multi-threaded
>programs can lead to somewhat surprising results.

Such as?  If you are talking about having the process suspended
instead of the thread then this is dependent on the threading library
and the thread attributes and is no more or less surprising than any
other similar function.

> Use nanosleep(2) or setitimer(2) instead.

If you bothered to read what Sharad had said, the man page or the source,
you would find that usleep(3) _is_ implemented using nanosleep(2) so there
is no point in using nanosleep() instead of usleep().

--=20
Peter Jeremy
Please excuse any delays as the result of my ISP's inability to implement
an MTA that is either RFC2821-compliant or matches their claimed behaviour.

--/ZYM6PqDyfNytx60
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)

iD8DBQFHvw+N/opHv/APuIcRAlgwAKC8b44TjBzig/OooY82Fnf0wu3UcQCggZAs
HSlB6bjHDAOz5IGIiaGUvDY=
=lFml
-----END PGP SIGNATURE-----

--/ZYM6PqDyfNytx60--



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