Writing Files asynchronously



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.

So I'm hunting for a function equivalent to KillIO that I can use with
an async file write operation.

Is there such a thing or is there a better way to work around my
original problem?

Your thoughts please.



Gary

.



Relevant Pages

  • Re: Writing Files asynchronously
    ... > I have a classic app that uses FSWrite to store text into a file. ... > app will hang indefinitely. ... > I got the PBWriteAsync call to work to a point. ...
    (comp.sys.mac.programmer.codewarrior)
  • Re: Writing Files asynchronously
    ... > I have a classic app that uses FSWrite to store text into a file. ... > app will hang indefinitely. ... > So I went looking for a way to kill off the pending I/O request. ...
    (comp.sys.mac.programmer.codewarrior)
  • Where to get updated wininet.pas/dll?
    ... Have an app in D7 that downloads a file every N minutes. ... Since in some rare cases the download will just hang and resulting in my app ... BlockWrite(f, Buffer, BufferLen); ...
    (alt.comp.lang.borland-delphi)
  • Re: Can a user app hang a *IX system?
    ... > I have a situation where our programcompletely hang the system. ... > OS is MontaVista Embedded Linux on a xscale big-endian cpu. ... > Our app starts and hangs, and also hangs the system, can't ctrl-brk the ... driver hang the motherboard. ...
    (comp.unix.programmer)
  • Re: Where to get updated wininet.pas/dll?
    ... Have an app in D7 that downloads a file every N minutes. ... Since in some rare cases the download will just hang and resulting in my app to hang, i'm trying to implement a timeout in the filedownload. ... the jam up could be in a socket session and not in response ...
    (alt.comp.lang.borland-delphi)