[fpc-pascal] Unicodestrings and Assign(File)

Sven Barth pascaldragon at googlemail.com
Sat May 19 19:09:02 CEST 2012


On 19.05.2012 18:59, Marco van de Voort wrote:
> In our previous episode, Sven Barth said:
>>> Think what happens if those are simply "cloned".
>>>
>>
>> Why shouldn't reference types work in threadvard records? As long as the
>> reference count mechanism does it's work correctly it should work.
>
> Afaik because the ref count mechanism doesn't. The cloning process might be
> done by the OS.
>
> So you have a record with that points to an ansistring with ref count 1, and
> then you create twenty threads, and you have 20 records that point to an
> ansistring with refcount 1.
>
> For the same reason, the content of the buffer is duplicated.
>
> If e.g. you have 'blabla' in a threadvar filerec buffer, create a few
> threads and flush them, you will have several times 'blabla'  written
>
> But Pierre and Sergei have done so much on TLS, that I don't know the
> current situation.

After writing the mail you answered to this occured to me as well which 
is why I wrote another mail directly after that ;)

But nevertheless thank you for explaining.

Regards,
Sven



More information about the fpc-pascal mailing list