Re: Writing Files asynchronously
- From: David Phillip Oster <oster@xxxxxxxx>
- Date: Fri, 26 Aug 2005 05:14:06 GMT
In article <1124730377.140157.50750@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
grice@xxxxxxxxxxxx wrote:
> I have a classic app that uses FSWrite to store text into a file.
> Ocassionally the app hangs when FSWrite is referencing a file on a
> remote volume (Sun Unix disk with an AppleTalk stack installed). The
> app will hang indefinitely (or until the user restarts the machine).
>
> The problem is probably someplace in the Unix driver code and the
> company that produced that code is gone.
>
> I would like to work around the hang condition so I thought I'd convert
> the FSWrite call to a PBWriteAsync call so I could monitor the
> operation and kill off the write operation if it exceeded some
> reasonable threshold. I coded the call up.
>
> I got the PBWriteAsync call to work to a point. If the call completes
> successfully, all is good. But when the call fails to complete, the
> code then proceeds to close the file without change and then the app
> abruptly crashes.
>
> I suspect that the PBWrite request is actually completing after the
> file is closed and writing over something that should remain untouched
> by errant applications.
>
> So I went looking for a way to kill off the pending I/O request.
>
> KillIO seemed like an obvious choice at first but I soon discovered it
> was intended to be used at the device driver level rather then the file
> I/O level.
In Classic, you should be able to use KillIO to kill a PBWriteAsync,
even if it is to a file.
Just don't re-use the same parameter block for the KillIO that you used
for the PBWriteAsync.
Just a guess. I have no direct knowledge.
--
David Phillip Oster
.
- References:
- Writing Files asynchronously
- From: grice
- Writing Files asynchronously
- Prev by Date: Re: GDB with CodeWarrior
- Next by Date: Re: Problem with CW 9.6 and release builds
- Previous by thread: Re: Writing Files asynchronously
- Next by thread: compile-error in header
- Index(es):
Relevant Pages
|