Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Feb 2008 17:14:47 +0200
From:      Andrew Pogrebennyk <marduk@portaone.com>
To:        freebsd-hackers@freebsd.org
Cc:        Sharad Chandra <sharadc@in.niksun.com>
Subject:   Re: usleep
Message-ID:  <47BEE6E7.9030804@portaone.com>
In-Reply-To: <200802221558.42443.sharadc@in.niksun.com>
References:  <200802221558.42443.sharadc@in.niksun.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Sharad,
Additionally, this C routine is considered obsolete (unlike shell
command by the same name). The interaction of this function with SIGALRM
and other timer functions such as sleep(), alarm(), setitimer(), and
nanosleep() is unspecified. Additionally, its use in multi-threaded
programs can lead to somewhat surprising results. Use nanosleep(2) or
setitimer(2) instead.

Sharad Chandra wrote:
> Hi Guys,
> 
> 	Does usleep work for you? i just saw it is implemented over nanosleep which 
> passes a struct timeval to "select".
> 
> on my system, one of instance for usleep and select sleep value.
> 
> provided
> (sec).(microsec) => select (sleep) usleep (sleep)
> 0.000000 => select: 0.000004 usleep: 0.000008
> 0.000001 => select: 0.002199 usleep: 0.001758
> 0.000002 => select: 0.004125 usleep: 0.001688
> 0.000003 => select: 0.005546 usleep: 0.001999
> 0.000004 => select: 0.006645 usleep: 0.002045
> 0.000005 => select: 0.001374 usleep: 0.002034
> 0.000006 => select: 0.002480 usleep: 0.001996
> 0.000007 => select: 0.006715 usleep: 0.001998
> 0.000008 => select: 0.002297 usleep: 0.001662
> 0.000009 => select: 0.002635 usleep: 0.001999
> 0.000010 => select: 0.003717 usleep: 0.001988
> 
> --
> 
> Thanks
> Sharad Chandra

-- 
Sincerely,
Andrew Pogrebennyk





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