Sharing Ref Counted Containers

2010-08-04 Thread dsimcha
I noticed that std.container.Array uses completely unsynchronized reference counting. Does that mean that it's basically impossible to share it across threads without introducing race conditions into the reference counting code, even if you synchronize on other updates? Are there any plans to mak

Re: Sharing Ref Counted Containers

2010-08-04 Thread Andrei Alexandrescu
On 08/04/2010 08:02 PM, dsimcha wrote: I noticed that std.container.Array uses completely unsynchronized reference counting. Does that mean that it's basically impossible to share it across threads without introducing race conditions into the reference counting code, even if you synchronize on o

Re: Sharing Ref Counted Containers

2010-08-04 Thread Jonathan M Davis
On Wednesday 04 August 2010 18:20:36 Andrei Alexandrescu wrote: > On 08/04/2010 08:02 PM, dsimcha wrote: > > I noticed that std.container.Array uses completely unsynchronized > > reference counting. Does that mean that it's basically impossible to > > share it across threads without introducing ra

Re: Sharing Ref Counted Containers

2010-08-04 Thread dsimcha
== Quote from Jonathan M Davis (jmdavisp...@gmail.com)'s article > On Wednesday 04 August 2010 18:20:36 Andrei Alexandrescu wrote: > > On 08/04/2010 08:02 PM, dsimcha wrote: > > > I noticed that std.container.Array uses completely unsynchronized > > > reference counting. Does that mean that it's b

Re: Sharing Ref Counted Containers

2010-08-04 Thread Michel Fortin
On 2010-08-04 21:55:33 -0400, Jonathan M Davis said: I would have thought that sharing pretty much _any_ type more complex than a primitive type without it being synchronized would be a bad idea. And since the standard containers obviously aren't going to be synchronized, I would expect you to

Re: Sharing Ref Counted Containers

2010-08-04 Thread Andrei Alexandrescu
Michel Fortin wrote: On 2010-08-04 21:55:33 -0400, Jonathan M Davis said: I would have thought that sharing pretty much _any_ type more complex than a primitive type without it being synchronized would be a bad idea. And since the standard containers obviously aren't going to be synchronized

Re: Sharing Ref Counted Containers

2010-08-05 Thread Michel Fortin
On 2010-08-05 00:05:55 -0400, Andrei Alexandrescu said: Personally, I'd say that not being able to use a container inside a synchronized class without subverting the type system looks like a failure of the type system. How about an insufficiency of the container library? Well, that depend