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