Thin Lock Implementation

Bartosz Milewski bartosz at relisoft.com
Tue Aug 19 12:32:53 PDT 2008


Steven Schveighoffer wrote:
> Reading further messages in your blog, I see that you expect sharing casts 
> to be recursive (to preserve the transitive nature of it).  What if two 
> shared objects have references to the same shared object?  If you 'unshare' 
> one parent, the other object now is shared, but its subcomponent is not 
> shared.  Is that considered ok?

No, it's definitely not ok, but unless there is a reference-counting 
mechanism in place, we can't do anything about it during casting. 
However, the sub-objects will be marked as exclusively owned by the 
casting thread, so any attempt from another thread to lock them will 
result in an exception. This is true to the spirit of casting in general.



More information about the Digitalmars-d mailing list