dave@pmafire.UUCP (Dave Remien) (03/30/89)
In article <1989Mar29.185842.14146@ateng.ateng.com> chip@ateng.ateng.com (Chip Salzenberg) writes:
:>>AT&T sucks for not having a sub-second clock interval. Although XENIX nap()
:>>is anemnic compared to BSD ftime().
:>
:>Which, of course, means that SysV missed the boat. Except for SysV R3.2,
:>which of course includes nap().
There are ways to get sub second sleeps in Sys V 3.[0|1], using a serial
port. I've had no problem getting 1/10 second sleeps on any of Bell,
Microport, or AT&T. If you're running an older version (pre 3.2), and want the
code, drop me a line; it's only a few dozen lines long. I didn't notice
that nap() was in the 3.2 lib; I'll have to look. Is that nap() as in
curses napms()? If so, even tho' you specify time in milliseconds, Sys V
rounds to normal sleep() intervals (in fact, that's what most curse's
napms() actually calls).
:>--
:>Chip Salzenberg <chip@ateng.com> or <uunet!ateng!chip>
:>A T Engineering Me? Speak for my company? Surely you jest!
:> "It's no good. They're tapping the lines."
Dave Remien - WINCO Computer Eng. Group -uunet!pmafire!dave- "Let's just look
at the extras on your new car - wire wheel spoke fenders, two way sneeze
through wind vents, stars and mudguards, chrome fender dents, and factory air
conditioned air, from our fully factory equipped airconditioned factory."
pcg@aber-cs.UUCP (Piercarlo Grandi) (04/01/89)
In article <608@pmafire.UUCP> dave@pmafire.UUCP (Dave Remien) writes: In article <1989Mar29.185842.14146@ateng.ateng.com> chip@ateng.ateng.com (Chip Salzenberg) writes: :>Which, of course, means that SysV missed the boat. Except for SysV R3.2, :>which of course includes nap(). There are ways to get sub second sleeps in Sys V 3.[0|1], using a serial port. Ughh. Using timeout on reads... I didn't notice that nap() was in the 3.2 lib; I'll have to look. Part of the full Xenix comp@atibility for 5.3.2; they even have shared segments and semaphores, Xenix style. BY the way, I have just been testing an Enix 5.3.2 beta copy, and I am going to report briefly on it soon enough. Summing up, the product is excellent, the documentation sahould be improved. Enix added some nice BSD compatibility things, such as the itimer facility, that os course is much better than nap(). As of now, I think that Enix is the way to go. 5.3.2 is horrible in one respect: too many ways to do the same things. There are at least four distinct and incompatible tty multiplexing mechanisms, six distinct and incomaptible inter process communication styles, and so on. 5.4 will be even worse, presumably, under this aspect. Ahhhh, compatibility... -- Piercarlo "Peter" Grandi | ARPA: pcg%cs.aber.ac.uk@nss.cs.ucl.ac.uk Dept of CS, UCW Aberystwyth | UUCP: ...!mcvax!ukc!aber-cs!pcg Penglais, Aberystwyth SY23 3BZ, UK | INET: pcg@cs.aber.ac.uk
rick@pcrat.UUCP (Rick Richardson) (04/06/89)
>:>>AT&T sucks for not having a sub-second clock interval. Although XENIX nap() >:>>is anemnic compared to BSD ftime(). >:> >:>Which, of course, means that SysV missed the boat. Except for SysV R3.2, >:>which of course includes nap(). If you have SVR3.2 there is a nap() in /lib/libx.a. But if you are at SVR3.0 or .1 level, all is not lost. In fact, any version of UNIX that has the STREAMS modules configured can do a nap(). Here's how to do nap portably across all UNIXes with STREAMS: #include <stropts.h> #include <poll.h> nap(milliseconds) int milliseconds; { struct pollfd dummy[1]; poll(dummy, 0L, milliseconds); } By telling "poll(2)" to poll exactly zero stream fd's, it does exactly that. Since there is no way for any input to arrive on zero fd's, poll just waits the timeout value. The timeout is spec'ed in milliseconds, but is probably subject to the granularity of clock ticks on your computer (100/second on a 386). -- Rick Richardson | JetRoff "di"-troff to LaserJet Postprocessor|uunet!pcrat!dry2 PC Research,Inc.| Mail: uunet!pcrat!jetroff; For anon uucp do:|for Dhrystone 2 uunet!pcrat!rick| uucp jetroff!~jetuucp/file_list ~nuucp/. |submission forms. jetroff Wk2200-0300,Sa,Su ACU {2400,PEP} 12013898963 "" \d\r\d ogin: jetuucp
dwc@homxc.ATT.COM (Malaclypse the Elder) (04/07/89)
another way to do this is to write a pseudo-device driver and use ioctl on that device to put an entry in the callout table to wake itself up in N ticks. then you can write a user level nap() to hide all the ugliness. or if you are uncomfortable with writing pseudo-device drivers, then just reserve a tty line, open it, ioctl it into raw mode and with a timeout value equivalent to the desired nap time and do a read from that line. again, once you know which tty line is reserved for this, you can hide all the ugliness in a function call. danny chen att!homxc!dwc
zeeff@b-tech.ann-arbor.mi.us (Jon Zeeff) (04/10/89)
If anyone missed it, I wrote and posted a nap() device driver for Sys V awhile back. Let me know if you want a copy. -- Jon Zeeff zeeff@b-tech.ann-arbor.mi.us Ann Arbor, MI mailrus!b-tech!zeeff