From owner-freebsd-hackers Thu Jun 27 13:09:21 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id NAA20733 for hackers-outgoing; Thu, 27 Jun 1996 13:09:21 -0700 (PDT) Received: from novell.com (sjf-ums.sjf.novell.com [130.57.10.171]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id NAA20728 for ; Thu, 27 Jun 1996 13:09:18 -0700 (PDT) Received: from INET-SJF-Message_Server by novell.com with Novell_GroupWise; Thu, 27 Jun 1996 13:09:05 -0700 Message-Id: X-Mailer: Novell GroupWise 4.1 Date: Thu, 27 Jun 1996 13:16:16 -0700 From: Darren Davis To: brandon@novell.com Cc: freebsd-hackers@freebsd.org Subject: portable microsecond sleeps - Reply Encoding: 28 Text Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >>> Brandon Gillespie 6/27 12:08pm >>> 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?-Brandon Gillespie >>> Ahh, my UnixWare days... There is no real good way to do this from user space in UnixWare. The UCB interfaces in UnixWare are somewhat broke as well. BTW UnixWare select is really implemented as a poll [We must walk carefully here otherwise we will get Terry going! {:-) ] I had implemented a psuedo driver in UnixWare to use the driver interfaces drv_hztousec(D3) as a highly accurate clock. Once having the clock you could "waste" the right amount of time. It is quite a trivial driver that implemented and ioctl interface that would use this interface. I tried looking for the code, but could not find it in my archives. Check into the man page and I think you will get the idea. Darren R. Davis Senior Software Engineer Novell, Inc.