<p dir="ltr">You don't miss anything, we agree. That is why I propose an explicit implementation either using a compiler switch or generic records (smart pointer). This way the developer has full control on when the feature is used or not. The smart pointer approach is more flexible I believe.</p>
<p dir="ltr">Sorry for the noise,<br>
Chriss</p>
<div class="gmail_quote">Στις 20 Σεπ 2014 9:34 μ.μ., ο χρήστης "Giuliano Colla" <<a href="mailto:giuliano.colla@fastwebnet.it">giuliano.colla@fastwebnet.it</a>> έγραψε:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<br>
<div>Il 20/09/2014 19:20, Boian Mitov ha
scritto:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div style="FONT-SIZE:10pt;FONT-FAMILY:'Arial';COLOR:#000000">
<div> Hi Chriss,</div>
<div> </div>
<div>Personally I favor reference counted objects. While there
are interfaces as you pointed, and in Delphi you can even
use smart pointers now, there is still a lot of cases when
you need to use objects, and have to manually free them.</div>
<div>In single threaded environment that is not such an issue,
but in parallel and heavily multithreaded environments,
reference counting is a life saver.</div>
</div>
</div>
</blockquote>
<br>
Can you explain how reference counting can be safely implemented in
a parallel multithreaded environment, without heavily affecting
performance?<br>
A mere increment or decrement of count means to get a lock and to
release a lock on that object. Application code can know what is
thread safe and what is not, and use lock only when appropriate.<br>
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.<br>
<br>
What do I miss?<br>
<br>
Giuliano<br>
<br>
</div>
<br>_______________________________________________<br>
fpc-devel maillist - <a href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a><br>
<a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel" target="_blank">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a><br>
<br></blockquote></div>