Re: WriteFile()



There is a subtle complication here:



For regular IO, WriteFile can complete successfully with less than the
requested number of bytes written.

If the Handle is opened with the FILE_FLAG_OVERLAPPED flag, then the IO
cannon partially complete regardless of whether or not the IO is blocking or
not.



Consider two threads that write to overlapping sections of a file. In order
to ensure sequential consistency, the first IOP MUST complete totally before
the seccond hits the disk.


"Slava M. Usov" <stripit.slough@xxxxxxx> wrote in message
news:#v#4dW1PFHA.2356@xxxxxxxxxxxxxxxxxxxxxxx
> "Hector Santos" <nospamhere@xxxxxxxxxxxxxx> wrote in message
> news:uyxFNMtPFHA.3196@xxxxxxxxxxxxxxxxxxxxxxx
>
> [...]
>
> > Synchronous 100% meant a blocked call.
>
> This is what I said.
>
> [...]
>
> > That has nothing to do with the fact whether there is a timeout
> > consideration. It may part of the equation or not.
>
> This is what I said, too.
>
> These two statements contradict with your original statement that
> '"synchronous operation" [...] implies block with no timeouts'.
>
> [...]
>
> > For a blocking WriteFile() when *no timeout* is expected or the device
> > is prepared for *no timeout* behavior, the call is 100% blocked and
there
> > are only two possible result:
> >
> > - Success where request = written
> > - Error
> >
> > Anything else is a unexpected design framework.
>
> 'request = written' can be binary if only one byte is involved. If there
are
> more data, it depends on the medium. For serial ports and sockets, to name
> just two, it can be less than the entire data size. This is not Windows
> specific.
>
> [...]
>
> > I don't know how much simple it can get or why this is even a question.
>
> It is not. The concept is much older than WriteFile(). Have a look at
> _write(). As far as I can tell, it has not changed much since 1972 when
what
> later became known as the C Standard Library was created. And it may also
> complete _successfully_ upon writing _less_ than requested.
>
> S
>
>


.



Relevant Pages

  • Re: WriteFile()
    ... > Consider two threads that write to overlapping sections of a file. ... >> 'request = written' can be binary if only one byte is involved. ... The concept is much older than WriteFile(). ...
    (microsoft.public.win32.programmer.kernel)
  • Re: WriteFile()
    ... If you design a I/O application with the concrete design criteria that ... no timeout whether that means the device is known to have no ... < request regardless of the device and/or its device capabilities and/or ... values when WriteFile returns TRUE. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: WriteFile()
    ... If you design a I/O application with the concrete design criteria that there ... no timeout whether that means the device is known to have no ... < request regardless of the device and/or its device capabilities and/or ... values when WriteFile returns TRUE. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Cannot jump to new part of Silverlight video when using handle
    ... Thanks Bruce. ... I just discovered that if I modify my handler to use WriteFile, ... There is nothing about a range in the request header: ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Unable to start thread from ASP.net app with windows server 2003
    ... > return the response back to the user before the thread finishes. ... > but I can't get a thread to start on a new win 2003 server. ... Are you aware that WriteFile may well be executing after the request is ... At that time, the Page, Request, etc. are all garbage. ...
    (microsoft.public.dotnet.framework.aspnet)

Loading