On 21.09.2014 05:34, Hans-Peter Diettrich wrote:
Sven Barth schrieb:
Am 20.09.2014 20:34 schrieb "Giuliano Colla"

 > A general mechanism to be reliable should take into account all
possibilities. If it does, it will block threads even when
unnecessary. If it doesn't, it will be unsafe.

That would work the same way as it does in interfaces, arrays and
strings: using Interlocked*-functions.

As I understand Interlocked Inc/Dec funtionality, it only protects the
update of the reference counter against interrupts, but not the tests
required before/after this update. As a precaution a RefCount should at
least be incremented as soon as there exists a *chance*, that the
reference is used/copied in some piece of currently active code
(thread...).

No, why should it? It works pretty well with interfaces, strings and arrays (let's put aside modifying the latter two, because COW is not needed here).

Regards,
Sven

_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to