Re: WriteFile()
- From: "Slava M. Usov" <stripit.slough@xxxxxxx>
- Date: Mon, 11 Apr 2005 21:29:10 +0200
"Hector Santos" <nospamhere@xxxxxxxxxxxxxx> wrote in message
news:u9XBHzrPFHA.1528@xxxxxxxxxxxxxxxxxxxxxxx
[...]
> Note he said, "synchronous operation" which implies block with no
> timeouts.
I do not understand how this implication comes about. Synchronous IO means
exactly one thing: the caller will not be able to do anything until IO
terminates, successfully, unsuccessfully, or semi-successfully. Or
quasi-successfully, if you will. WriteFile() is a generic routine and it
makes no assumptions as to how 'successfully', 'semi-successfully' and
'quasi-successfully' can be differentiated. It simply returns three things
to the caller: general success/failure status, size of the successful
transfer, and error code. It can do that synchronously or asynchronously.
The rest depends on the medium involved. The caller always knows the
character of the medium, and should interpret those three things properly.
Speaking of the medium, much depends on tradition, as you say. Files are
traditionally handled without any timeouts. Even though there are actually
timeouts as you go down to metal, they will only trigger re-tries and
eventually failures; timeouts and 'success' are incompatible for files,
async or not.
Communications, again traditionally, are built around timeouts. A timeout
may trigger either 'success' or 'failure', but it takes more than binary
logic to handle timeouts anyway, so what is actually returned as 'status' is
only a matter of convention; the important data are the 'size of successful
transfer' and 'error code'. With async IO, one can easily do without
built-in timeouts, because the caller can always cancel IO. With sync IO,
the caller cannot cancel IO, nor can anyone else; the only way to get rid of
stuck IO is to kill blocked threads, which leaks resources. The latter means
that sync IO becomes impractical without timeouts.
S
.
- Follow-Ups:
- Re: WriteFile()
- From: Hector Santos
- Re: WriteFile()
- References:
- WriteFile()
- From: Frank A. Uepping
- Re: WriteFile()
- From: Hector Santos
- Re: WriteFile()
- From: Gary Chanson
- Re: WriteFile()
- From: Chris Burnette
- Re: WriteFile()
- From: Hector Santos
- Re: WriteFile()
- From: Chris Burnette
- Re: WriteFile()
- From: Hector Santos
- Re: WriteFile()
- From: Alexander Grigoriev
- Re: WriteFile()
- From: Hector Santos
- WriteFile()
- Prev by Date: Re: HANDLE Thread Safety
- Next by Date: Re: Get number of child threads
- Previous by thread: Re: WriteFile()
- Next by thread: Re: WriteFile()
- Index(es):
Relevant Pages
|
Loading