home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / mac / programm / 22183 < prev    next >
Encoding:
Internet Message Format  |  1993-01-25  |  1.8 KB

  1. Path: sparky!uunet!usc!sdd.hp.com!decwrl!waikato.ac.nz!ldo
  2. From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: Closing files at interrupt time
  5. Message-ID: <1993Jan26.171135.13445@waikato.ac.nz>
  6. Date: 26 Jan 93 17:11:35 +1300
  7. References: <1993Jan25.204808.11120@news.media.mit.edu>
  8. Organization: University of Waikato, Hamilton, New Zealand
  9. Lines: 24
  10.  
  11. In article <1993Jan25.204808.11120@news.media.mit.edu>, delphi@media-lab.media.mit.edu (Andrew J. Kass) writes:
  12. > I am writing a library of sound routines, but have recently run into a major
  13. > problem. I am playing files using SndStartFilePlay asynchronously. In the
  14. > completion routine, I set my A5 to access my globals, get the fRefNum of the
  15. > file I was playing, and then call FSClose to close the file. The problem is,
  16. > every now and then, not at repeatable intervals, the machine will hang during that
  17. > call to FSClose. I can get into MacsBug and look at the stack to verify that it
  18. > is hanging during FSClose, but any attempt to exit to shell fails and I have
  19. > to reboot the machine.
  20.  
  21. I'd say the problem is the file system is in the middle of another call when
  22. your interrupt routine tries to do the close. Remember, the file system
  23. can only process one call at a time! What you should do is use PBCloseAsync
  24. instead, which will queue the request for execution when the file system
  25. isn't busy.
  26.  
  27. This is probably a general rule with *all* services that have an asynchronous
  28. and a synchronous form: *never* use the synchronous form from interrupt level.
  29.  
  30. Lawrence D'Oliveiro                       fone: +64-7-856-2889
  31. Computer Services Dept                     fax: +64-7-838-4066
  32. University of Waikato            electric mail: ldo@waikato.ac.nz
  33. Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+13:00
  34. All the best cliches are true.
  35.