December 10, 2008
Fawzi Mohamed wrote:
> On 2008-12-08 19:06:42 +0100, Kagamin <spam@here.lot> said:
> 
>> torhu Wrote:
>>
>>> Tango also opens files for writing with shared reading disabled by
>>> default.  I'm not sure why, but maybe someone can remember the reason
>>> for it.
>>
>> they just forgot? :)
> 
> consistency with windows as far as I know, so the program behaves the same on windows and unix.
> 
> Fawzi
> 
Its not consistent with any other libraries of any other compilers I know of. The Linux implementation is in my opinion certainly incorrect.
December 10, 2008
Spacen Jasset wrote:

> Fawzi Mohamed wrote:
>> On 2008-12-08 19:06:42 +0100, Kagamin <spam@here.lot> said:
>> 
>>> torhu Wrote:
>>>
>>>> Tango also opens files for writing with shared reading disabled by default.  I'm not sure why, but maybe someone can remember the reason for it.
>>>
>>> they just forgot? :)
>> 
>> consistency with windows as far as I know, so the program behaves the same on windows and unix.
>> 
>> Fawzi
>> 
> Its not consistent with any other libraries of any other compilers I know of. The Linux implementation is in my opinion certainly incorrect.

On Windows, the "default" is not shared in the sense that that is what you get if you pass no specific sharing parameters (0). I'm not windows expert, but if I read the CreateFile docs correctly, having some form of sharing as default can be wrong (causing errors) in some cases?

On Posix, the situation is quite different in that sharing is default. In fact non-sharing is not enforced by the system such that it is up to the application to figure out whether it should stay away or not.

I believe there is room for improvement, but I'm not sure the default should be different?

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource, #d.tango & #D: larsivi
Dancing the Tango
December 10, 2008
Lars Ivar Igesund Wrote:

> I'm not windows expert, but if I read the CreateFile docs correctly, having some form of sharing as default can be wrong (causing errors) in some cases?

if fact errors happen when two applications (or even the same application) try to get exclusive (default) access to the same file.
December 10, 2008
On Wed, 10 Dec 2008 14:12:13 +0300, Lars Ivar Igesund <larsivar@igesund.net> wrote:

> Spacen Jasset wrote:
>
>> Fawzi Mohamed wrote:
>>> On 2008-12-08 19:06:42 +0100, Kagamin <spam@here.lot> said:
>>>
>>>> torhu Wrote:
>>>>
>>>>> Tango also opens files for writing with shared reading disabled by
>>>>> default.  I'm not sure why, but maybe someone can remember the reason
>>>>> for it.
>>>>
>>>> they just forgot? :)
>>>
>>> consistency with windows as far as I know, so the program behaves the
>>> same on windows and unix.
>>>
>>> Fawzi
>>>
>> Its not consistent with any other libraries of any other compilers I
>> know of. The Linux implementation is in my opinion certainly incorrect.
>
> On Windows, the "default" is not shared in the sense that that is what you get if you pass no specific sharing parameters (0). I'm not windows expert, but if I read the CreateFile docs correctly, having some form of sharing as default can be wrong (causing errors) in some cases?
>
> On Posix, the situation is quite different in that sharing is default. In fact non-sharing is not enforced by the system such that it is up to the application to figure out whether it should stay away or not.
>
> I believe there is room for improvement, but I'm not sure the default should be different?
>

First of all, behaviour should be consistent across all platforms.

Second, FILE_SHARE_READ is completely safe. There won't be any problems if you write sequentially, i.e. rarely seek back and rewrite what you already wrote (and this covers more than 90% of use cases). I wont cause any problems in the latter case, too (application won't crash, handle gets invalidated or anything, but reading application should take additional care to re-read file entirely sometimes to stay up to date).
1 2 3 4 5 6 7
Next ›   Last »