File Open

Hi,

In Windows, is there a way to open a file in a non-blocking mode similar to
“O_NONBLOCK or O_NDELAY” in linux?

Thanks,
Sunil

> In Windows, is there a way to open a file in a non-blocking mode similar to

“O_NONBLOCK or O_NDELAY” in linux?

The default Windows way is like that. Read about asynchronous I/O:
http://msdn.microsoft.com/en-us/library/aa365683(v=VS.85).aspx .


Aram Hăvărneanu

If I understand correctly, async IO mentioned below allows to do READ/WRITE
asynchronously. I am interested in OPEN system call that will not block. In
linux, if O_NONBLOCK is set in oflag field of “open(const char **path*, int
*oflag*, … );”, then the *open()* function will return without blocking
for the device to be ready or available.

On Mon, Sep 20, 2010 at 2:33 PM, Aram Hăvărneanu wrote:

> > In Windows, is there a way to open a file in a non-blocking mode similar
> to
> > “O_NONBLOCK or O_NDELAY” in linux?
>
> The default Windows way is like that. Read about asynchronous I/O:
> http://msdn.microsoft.com/en-us/library/aa365683(v=VS.85).aspxhttp:.
>
> –
> Aram Hăvărneanu
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
></http:>

>In Windows, is there a way to open a file in a non-blocking mode similar to "O_NONBLOCK or

O_NDELAY" in linux?

Only the sockets support this in Windows, and also select() only works for sockets.

Windows has overlapped IO instead, the more flexible replacement of this feature.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

>interested in OPEN system call that will not block

Pre-Vista, the whole MJ_CREATE path is always synchronous and cannot be async.

In Vista+, MJ_CREATE is async to some degree, but mainly to be cancellable only (SMB redir’s creates in Vista+ are cancellable).

I’m not sure that app-exposed MJ_CREATE is supported in Vista+.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com