[Boost-bugs] [ boost-Support Requests-1445474 ] boost.iostreams file_descriptor and sharing

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Boost-bugs] [ boost-Support Requests-1445474 ] boost.iostreams file_descriptor and sharing

SourceForge.net
Support Requests item #1445474, was opened at 2006-03-08 01:03
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=207586&aid=1445474&group_id=7586

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: boost.iostreams file_descriptor and sharing

Initial Comment:
Hi!

I have couple of questions about the behavior of
boost::iostreams::file_descriptor.

First, I've noticed that it always opens files with
exclusive access. That is, it calls CreateFileA with a
dwShareMode of 0, which means that "the object cannot
be shared and cannot be opened again until the handle
is closed". Is this by design? Wouldn't it be
reasonable to use a share mode of FILE_SHARE_READ when
opening a file only for reading?

Second, the function file_descriptor::open has a third
parameter 'base', which appears to be extra open mode
bits that are always on, in addition to those in the
second parameter to stream::open. What is the purpose
of this? Since there is a stream::open function with
three parameters I can specify these extra bits as well
when opening the file, in order to actually get the
file opened only for reading, but I worry that this
will somehow violate the design of the file_descriptor
class.

I've modified my copy of file_descriptor::open to use a
share mode of FILE_SHARE_READ when opening a file only
for reading and am now calling stream::open with three
arguments in order to make this happen. Is this safe?
It appears to work in the very limited cases I've tried
so far.

Yours,
Gunnar Blomberg ([hidden email])

PS. Thanks for an excellent library!
DS.


----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=207586&aid=1445474&group_id=7586


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Boost-bugs mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/boost-bugs
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost