From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 22 15:28:43 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 714C016A407 for ; Fri, 22 Feb 2008 15:28:43 +0000 (UTC) (envelope-from marduk@portaone.com) Received: from bugor.portaone.com (bugor.portaone.com [65.61.203.147]) by mx1.freebsd.org (Postfix) with ESMTP id 61F7713C45D for ; Fri, 22 Feb 2008 15:28:43 +0000 (UTC) (envelope-from marduk@portaone.com) Received: from k3-gw.portaone.com ([193.28.87.193] helo=[192.168.10.98]) by bugor.portaone.com (8.11.3/8.11.3) with ESMTP id 1JSZbs-0002tY-BO; Fri, 22 Feb 2008 07:14:48 -0800 Message-ID: <47BEE6E7.9030804@portaone.com> Date: Fri, 22 Feb 2008 17:14:47 +0200 From: Andrew Pogrebennyk User-Agent: Thunderbird 2.0.0.6 (X11/20071022) MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: <200802221558.42443.sharadc@in.niksun.com> In-Reply-To: <200802221558.42443.sharadc@in.niksun.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Sharad Chandra Subject: Re: usleep X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Feb 2008 15:28:43 -0000 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