home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / programm / 3850 < prev    next >
Encoding:
Text File  |  1992-07-22  |  1.9 KB  |  74 lines

  1. Path: sparky!uunet!mcsun!fuug!demos!kiae!glas!demos!hagki.toppoint.de!hagar
  2. From: hagar@hagki.toppoint.de
  3. Newsgroups: comp.unix.programmer
  4. Date: 18 Jul 92 05:59 MDT
  5. Subject: Re: sleep for less than 1 second?
  6. Sender: Notesfile to Usenet Gateway <notes@glas.apc.org>
  7. Message-ID: <1992Jul18.015947.2383@hagki.topp>
  8. References: <1992Jul8.172645.8445@uoft02.utol>
  9. Nf-ID: #R:1992Jul8.172645.8445@uoft02.utol:-1438768942:1992Jul18.015947.2383@hagki.topp:-1952476607:001:1397
  10. Nf-From: hagki.toppoint.de!hagar    Jul 18 05:59:00 1992
  11. Lines: 61
  12.  
  13.  
  14. john@jwt.UUCP (John Temples) writes:
  15.  
  16. >In article <1305@mwtech.UUCP> martin@mwtech.UUCP (Martin Weitzel) writes:
  17. >>On recent SysV-s you may also find `napms()' as part of the curses library
  18.  
  19. >I have this on my SVR3.2 system, but it doesn't work.  It always
  20. >returns immediately, regardless of the requested sleep time.
  21.  
  22. From ISC's (SVR3.2) man page of curses:
  23.  
  24.       BUGS
  25.  
  26. [ ... ]
  27.  
  28.            The argument to napms() is currently rounded up to the
  29.            nearest second.
  30.  
  31. [ ... ]
  32.  
  33.       Rev. Extended    Terminal Interface                Page 40
  34.  
  35. Maybe napms() does not round it up on your system, but down?
  36. Who knows? Who cares?
  37.  
  38. Use poll(2)!
  39.  
  40. Here is an example:
  41.  
  42. ---------------------------------------------------------------------------
  43.  
  44. /*
  45.  * sleep_ms(timeout) - sleep for timeout milliseconds (USG)
  46.  */
  47.  
  48. #include <poll.h>
  49.  
  50. int
  51. sleep_ms(timeout)
  52. int timeout;
  53. {
  54.     struct pollfd dummy[1];
  55.  
  56.     return(poll(dummy, 0L, timeout));
  57. }
  58.  
  59.  
  60. ---------------------------------------------------------------------------
  61.  
  62. Sorry. It's no code of mine, but I forgot where I got this
  63. from. So I'm not able to name the guy who wrote this...
  64.  
  65. cu
  66.     hag
  67.     
  68. -- 
  69.  Oliver Fink, Baumweg 46, 2300 Kiel 1, Germany  +49 431 682423
  70. -------------------------------------------------------------------------------
  71. Es gibt 1000 gute Gruende, auf dieses Land stolz zu sein;           Tote
  72. warum faellt uns jetzt auf einmal kein einziger mehr ein!?          Hosen
  73.  
  74.