<div dir="ltr"><br><br><div class="gmail_quote">On Mon, Aug 25, 2008 at 10:24 AM, Rémi Denis-Courmont <span dir="ltr"><<a href="mailto:rdenis@simphalempin.com">rdenis@simphalempin.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="Ih2E3d"><br>
On Mon, 25 Aug 2008 09:33:21 +0200, Pierre d'Herbemont<br>
<<a href="mailto:pdherbemont@free.fr">pdherbemont@free.fr</a>> wrote:<br>
>> We cannot have reference counting for blocks, because blocks are<br>
>> modified<br>
>> downstream. The only thing we have is block_Duplicate, which is of<br>
>> course<br>
>> slow: malloc + memcpy.<br>
><br>
> No. The whole point of refcount is when to destroy it. Not to make<br>
> sure it won't change if you pass it to a function.<br>
<br>
</div>Heck no. Reference counting only works if you have a resource that can be<br>
shared in the first place. For a block of memory the only thing, you will<br>
at the very least want to share the data - otherwise there is nothing to<br>
share, so there is no opportunity for reference counting. On top of that,<br>
there are thread synchronization issues - our block layer is not<br>
thread-safe at all (let alone the block FIFO).</blockquote><div><br></div><div>I meant in that precise case (allow *destroy* ownership not to be passed by function call). If you want a full thread safe object, that is mutable and needs copying it's an other problem.</div>
<div><br></div><div>It seems that I am the only one to consider that an ideal API should preserve *destroy* ownership, unless function name follows an explicit convention that says it would not. So don't worry :)</div>
<div><br></div><div>Well, we could at least put a comment somewhere to state that... That might help to prevent dummy error such as this commit.</div><div><br></div><div>Pierre.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
</blockquote></div></div>