<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<div class="moz-cite-prefix">Il 20/09/2014 19:20, Boian Mitov ha
scritto:<br>
</div>
<blockquote cite="mid:F82691EEB35A484493CDD6A4703CE774@mpc1"
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>
</body>
</html>