home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sys / sun / hardware / 4253 < prev    next >
Encoding:
Internet Message Format  |  1992-09-07  |  961 b 

  1. Path: sparky!uunet!auspex-gw!guy
  2. From: guy@Auspex.COM (Guy Harris)
  3. Newsgroups: comp.sys.sun.hardware
  4. Subject: Re: Using /dev/audio in applications
  5. Message-ID: <14485@auspex-gw.auspex.com>
  6. Date: 5 Sep 92 01:00:51 GMT
  7. References: <1992Sep4.204344.22328@news.Hawaii.Edu>
  8. Sender: news@auspex-gw.auspex.com
  9. Organization: Auspex Systems, Santa Clara
  10. Lines: 13
  11. Nntp-Posting-Host: bootme.auspex.com
  12.  
  13. >BUT, the application will hang if some other process is using /dev/audio.
  14. >I though the O_NONBLOCK would prevent this. 
  15. >
  16. >Can anyone provide a simple solution. Or point out my error?
  17.  
  18. Your error is that you assumed Sun's driver would properly handle the
  19. new POSIX O_NONBLOCK flag on an open.
  20.  
  21. It doesn't; try using O_NDELAY instead (either the BSD or SV version). 
  22. If O_NDELAY is used in an open, and some other process has the device open,
  23. the open should return -1 and set "errno" to EBUSY.
  24.  
  25. Note that you may want to turn O_NDELAY *off* once the device is opened.
  26.